[FFmpeg-devel] [PATCH] CrystalHD: fix pStride value and set aspect ratio

Michael Niedermayer michaelni at gmx.at
Tue Apr 17 15:51:55 CEST 2012


On Tue, Apr 17, 2012 at 10:17:27AM +0200, Istvan Sebok wrote:
> 2012. április 16. 20:33 Istvan Sebok írta, <sebok.istvan at gmail.com>:
> 
> >
> >
> > 2012. április 16. 0:49 Reimar Döffinger írta, <Reimar.Doeffinger at gmx.de>:
> >
> > On Mon, Apr 16, 2012 at 12:18:44AM +0200, Istvan Sebok wrote:
> >> > 2012. április 15. 22:48 Reimar Döffinger írta, <
> >> Reimar.Doeffinger at gmx.de>:
> >> >
> >> > > On Sun, Apr 15, 2012 at 09:13:15PM +0200, Istvan Sebok wrote:
> >> > > >
> >> > >
> >> > > A bit more of a description wouldn't hurt.
> >> > > Are you absolutely sure the 1080 pStride value actually works?
> >> > > 1080 would be a very, very strange value for a supported
> >> > > video width.
> >> > >
> >> >
> >> > I didn't add 1080 pStride value I just changed 'else if' order. I have
> >> > 70015 card, I can't test it.
> >>
> >> Well, from the code behaviour point changing the else if order has
> >> the same effect as adding it.
> >> Without someone to test, removing it would be safer than changing
> >> the order.
> >>
> >>
> > OK. I wait few days. If nobody tests it, I will remove these lines and I
> > will send a new patch.
> >
> >
> > Scott D. Davilla helped for me, he wrote:
> 
> The 70015 card provides a correct stride but the 70012 card is stride
> quantized to 720/1280/1920
> 
> The new patch fix warning: "'pStride' may be used uninitialized in this
> function" too.

maintainer added to CC, just to make sure its not missed
the patches look fine to me but i dont know the code nor do i have
hardware to test



>  crystalhd.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 76b7b6736f6391ded34e0bf2d315cb7f3684a2f8  0001-CrystalHD-fix-pStride-value.patch
> From 2f8b4e74d7ae8113b7d8c9adb577220d9db107f7 Mon Sep 17 00:00:00 2001
> From: sebist <sebok.istvan at gmail.com>
> Date: Tue, 17 Apr 2012 09:29:27 +0200
> Subject: [PATCH 1/2] CrystalHD: fix pStride value.
> 
> 
> Signed-off-by: sebist <sebok.istvan at gmail.com>
> ---
>  libavcodec/crystalhd.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c
> index 5fcb07a..2bae8f4 100644
> --- a/libavcodec/crystalhd.c
> +++ b/libavcodec/crystalhd.c
> @@ -656,8 +656,7 @@ static inline CopyRet copy_frame(AVCodecContext *avctx,
>              pStride = 720;
>          else if (width <= 1280)
>              pStride = 1280;
> -        else if (width <= 1080)
> -            pStride = 1080;
> +        else pStride = 1920;
>          sStride = av_image_get_linesize(avctx->pix_fmt, pStride, 0);
>      } else {
>          sStride = bwidth;
> -- 
> 1.7.5.4
> 

>  crystalhd.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> b0d98e04af7f718f4265ba274de4df53b4172bae  0002-CrystalHD-Set-aspect-ratio.patch
> From ad3cde6fe13f6b6aa38245b51265b05e19b00c08 Mon Sep 17 00:00:00 2001
> From: sebist <sebok.istvan at gmail.com>
> Date: Tue, 17 Apr 2012 09:36:27 +0200
> Subject: [PATCH 2/2] CrystalHD: Set aspect ratio.
> 
> 
> Signed-off-by: sebist <sebok.istvan at gmail.com>
> ---
>  libavcodec/crystalhd.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 50 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c
> index 2bae8f4..f60805c 100644
> --- a/libavcodec/crystalhd.c
> +++ b/libavcodec/crystalhd.c
> @@ -741,6 +741,56 @@ static inline CopyRet receive_frame(AVCodecContext *avctx,
>          av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Initial format change\n");
>          avctx->width  = output.PicInfo.width;
>          avctx->height = output.PicInfo.height;
> +        switch ( output.PicInfo.aspect_ratio ) {
> +        case vdecAspectRatioSquare:
> +            avctx->sample_aspect_ratio = (AVRational) {  1,  1}; 
> +            break;
> +        case vdecAspectRatio12_11:
> +            avctx->sample_aspect_ratio = (AVRational) { 12, 11}; 
> +            break;
> +        case vdecAspectRatio10_11:
> +            avctx->sample_aspect_ratio = (AVRational) { 10, 11};
> +            break;
> +        case vdecAspectRatio16_11:
> +            avctx->sample_aspect_ratio = (AVRational) { 16, 11}; 
> +            break;
> +        case vdecAspectRatio40_33:
> +            avctx->sample_aspect_ratio = (AVRational) { 40, 33}; 
> +            break;
> +        case vdecAspectRatio24_11:
> +            avctx->sample_aspect_ratio = (AVRational) { 24, 11};
> +            break;
> +        case vdecAspectRatio20_11:
> +            avctx->sample_aspect_ratio = (AVRational) { 20, 11}; 
> +            break;
> +        case vdecAspectRatio32_11:
> +            avctx->sample_aspect_ratio = (AVRational) { 32, 11};
> +            break;
> +        case vdecAspectRatio80_33:
> +            avctx->sample_aspect_ratio = (AVRational) { 80, 33}; 
> +            break;
> +        case vdecAspectRatio18_11:
> +            avctx->sample_aspect_ratio = (AVRational) { 18, 11}; 
> +            break;
> +        case vdecAspectRatio15_11:
> +            avctx->sample_aspect_ratio = (AVRational) { 15, 11};
> +            break;
> +        case vdecAspectRatio64_33:
> +            avctx->sample_aspect_ratio = (AVRational) { 64, 33}; 
> +            break;
> +        case vdecAspectRatio160_99:
> +            avctx->sample_aspect_ratio = (AVRational) {160, 99};
> +            break;
> +        case vdecAspectRatio4_3:
> +            avctx->sample_aspect_ratio = (AVRational) {  4,  3};
> +            break;
> +        case vdecAspectRatio16_9:
> +            avctx->sample_aspect_ratio = (AVRational) { 16,  9}; 
> +            break;
> +        case vdecAspectRatio221_1:
> +            avctx->sample_aspect_ratio = (AVRational) {221,  1};
> +            break;
> +        }
>          return RET_COPY_AGAIN;
>      } else if (ret == BC_STS_SUCCESS) {
>          int copy_ret = -1;
> -- 
> 1.7.5.4
> 

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120417/9eb56d4a/attachment.asc>


More information about the ffmpeg-devel mailing list