[FFmpeg-cvslog] avcodec/h263dec: fix aspect of lead h263 EHC

Michael Niedermayer git at videolan.org
Sat Aug 24 19:06:05 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Aug 24 18:44:24 2013 +0200| [7495186fd49f6c9e701e387c2669e3f39b8900ab] | committer: Michael Niedermayer

avcodec/h263dec: fix aspect of lead h263 EHC

Fixes part of ticket925

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7495186fd49f6c9e701e387c2669e3f39b8900ab
---

 libavcodec/flvdec.c     |    3 +++
 libavcodec/h263dec.c    |    3 +++
 libavcodec/ituh263dec.c |    1 +
 libavcodec/mpegvideo.h  |    1 +
 4 files changed, 8 insertions(+)

diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index bb693d7..36e53c5 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -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),
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index faa54f5..626be97 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -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)
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 6d06a09..cd6ed4e 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -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;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 9614e99..23f0164 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -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



More information about the ffmpeg-cvslog mailing list