avcodec/h263dec: fix aspect of lead h263 EHC
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Aug 2013 16:44:24 +0000 (18:44 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Aug 2013 16:59:58 +0000 (18:59 +0200)
Fixes part of ticket925

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/flvdec.c
libavcodec/h263dec.c
libavcodec/ituh263dec.c
libavcodec/mpegvideo.h

index bb693d7..36e53c5 100644 (file)
@@ -107,6 +107,9 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
     }
     s->f_code = 1;
 
+    if (s->ehc_mode)
+        s->avctx->sample_aspect_ratio= (AVRational){1,2};
+
     if(s->avctx->debug & FF_DEBUG_PICT_INFO){
         av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%d\n",
                s->droppable ? 'D' : av_get_picture_type_char(s->pict_type),
index faa54f5..626be97 100644 (file)
@@ -113,6 +113,9 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
     s->codec_id= avctx->codec->id;
     avctx->hwaccel= ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
 
+    if (avctx->stream_codec_tag == AV_RL32("l263") && avctx->extradata_size == 56 && avctx->extradata[0] == 1)
+        s->ehc_mode = 1;
+
     /* for h263, we allocate the images after having read the header */
     if (avctx->codec->id != AV_CODEC_ID_H263 && avctx->codec->id != AV_CODEC_ID_H263P && avctx->codec->id != AV_CODEC_ID_MPEG4)
         if ((ret = ff_MPV_common_init(s)) < 0)
index 6d06a09..cd6ed4e 100644 (file)
@@ -1033,6 +1033,7 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
                 height = ff_h263_format[format][1];
                 s->avctx->sample_aspect_ratio= (AVRational){12,11};
             }
+            s->avctx->sample_aspect_ratio.den <<= s->ehc_mode;
             if ((width == 0) || (height == 0))
                 return -1;
             s->width = width;
index 9614e99..23f0164 100644 (file)
@@ -545,6 +545,7 @@ typedef struct MpegEncContext {
     int prev_mb_info, last_mb_info;
     uint8_t *mb_info_ptr;
     int mb_info_size;
+    int ehc_mode;
 
     /* H.263+ specific */
     int umvplus;                    ///< == H263+ && unrestricted_mv