summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-26 14:34:52 +0100
committerAnton Khirnov <anton@khirnov.net>2013-11-29 14:19:48 +0100
commitb1aacd56685cd131f517e0551834a0bbd3f5f809 (patch)
tree85b3398809ccfed42f4f5b0ac2f6ce476ff64ca7 /libavcodec
parent038890740014dc33d2e2f04da7cf0a9da821264e (diff)
mpeg4videodec: move t_frame from MpegEncContext to Mpeg4DecContext
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpeg4video.h2
-rw-r--r--libavcodec/mpeg4videodec.c18
-rw-r--r--libavcodec/mpegvideo.h1
3 files changed, 11 insertions, 10 deletions
diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index fdb16be07d..60857cce11 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -70,6 +70,8 @@ typedef struct Mpeg4DecContext {
int rvlc;
///< could this stream contain resync markers
int resync_marker;
+ ///< time distance of first I -> B, used for interlaced b frames
+ int t_frame;
/* bug workarounds */
int divx_version;
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 95abad0ccd..4d045e263b 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1736,7 +1736,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
else
s->avctx->time_base.num = 1;
- s->t_frame = 0;
+ ctx->t_frame = 0;
if (ctx->shape != BIN_ONLY_SHAPE) {
if (ctx->shape == RECT_SHAPE) {
@@ -2123,14 +2123,14 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
}
ff_mpeg4_init_direct_mv(s);
- if (s->t_frame == 0)
- s->t_frame = s->pb_time;
- if (s->t_frame == 0)
- s->t_frame = 1; // 1/0 protection
- s->pp_field_time = (ROUNDED_DIV(s->last_non_b_time, s->t_frame) -
- ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame)) * 2;
- s->pb_field_time = (ROUNDED_DIV(s->time, s->t_frame) -
- ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame)) * 2;
+ if (ctx->t_frame == 0)
+ ctx->t_frame = s->pb_time;
+ if (ctx->t_frame == 0)
+ ctx->t_frame = 1; // 1/0 protection
+ s->pp_field_time = (ROUNDED_DIV(s->last_non_b_time, ctx->t_frame) -
+ ROUNDED_DIV(s->last_non_b_time - s->pp_time, ctx->t_frame)) * 2;
+ s->pb_field_time = (ROUNDED_DIV(s->time, ctx->t_frame) -
+ ROUNDED_DIV(s->last_non_b_time - s->pp_time, ctx->t_frame)) * 2;
if (!s->progressive_sequence) {
if (s->pp_field_time <= s->pb_field_time || s->pb_field_time <= 1)
return FRAME_SKIPPED;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 5620791682..30a726f53d 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -607,7 +607,6 @@ typedef struct MpegEncContext {
PutBitContext tex_pb; ///< used for data partitioned VOPs
PutBitContext pb2; ///< used for data partitioned VOPs
int mpeg_quant;
- int t_frame; ///< time distance of first I -> B, used for interlaced b frames
int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG4
/* divx specific, used to workaround (many) bugs in divx5 */