[FFmpeg-devel] [libav-devel] [PATCH] avcodec/cfhd: Fixes cfhd_odd.mov which has a resolution of 496x241

Vittorio Giovara vittorio.giovara at gmail.com
Sat Mar 5 19:34:37 CET 2016


On Sat, Mar 5, 2016 at 1:06 PM, Kieran Kunhya <kieran at kunhya.com> wrote:
> In this case container width/height is better however.
> Thanks to koda for the sample
> ---
>  libavcodec/cfhd.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
> index e37bef0..98f16d3 100644
> --- a/libavcodec/cfhd.c
> +++ b/libavcodec/cfhd.c
> @@ -467,6 +467,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame,
>                  coeff_data += lowpass_width;
>              }
>
> +            /* Align to mod-4 position to continue reading tags */
> +            bytestream2_seek(&gb, bytestream2_tell(&gb) & 3, SEEK_CUR);
> +
>              /* Copy last line of coefficients if odd height */
>              if (lowpass_height & 1) {
>                  memcpy(&coeff_data[lowpass_height * lowpass_width],
> --

Confirmed to work with the sample. Here is an addendum to avoid
displaying garbage (untested with other samples)

commit 658fdd157f12633006533bc67ffb3b0d44a198df
Author: Vittorio Giovara <vittorio.giovara at gmail.com>
Date:   Sat Mar 5 13:32:54 2016 -0500

    cfhd: Crop visible height

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index e37bef0..4d2e933 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -420,6 +420,8 @@ static int cfhd_decode(AVCodecContext *avctx, void
*data, int *got_frame,
                 break;
             }
             planes = av_pix_fmt_count_planes(s->coded_format);
+        } else if (tag == -85) {
+            avctx->height = data;
         } else
             av_log(avctx, AV_LOG_DEBUG,  "Unknown tag %i data %x\n",
tag, data);


-- 
Vittorio


More information about the ffmpeg-devel mailing list