From 7495186fd49f6c9e701e387c2669e3f39b8900ab Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 24 Aug 2013 18:44:24 +0200 Subject: [PATCH] avcodec/h263dec: fix aspect of lead h263 EHC Fixes part of ticket925 Signed-off-by: Michael Niedermayer --- 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 bb693d76c6..36e53c5dd0 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 faa54f57e1..626be97357 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 6d06a099e9..cd6ed4e620 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 9614e99c33..23f0164f2c 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