From: Anton Khirnov Date: Tue, 26 Nov 2013 13:34:52 +0000 (+0100) Subject: mpeg4videodec: move num_sprite_warping_points from MpegEncContext to Mpeg4DecContext X-Git-Tag: v10_alpha1~130 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=513d849bb605d3d862da1ada709bd2ca1ac68f58;p=platform%2Fupstream%2Flibav.git mpeg4videodec: move num_sprite_warping_points from MpegEncContext to Mpeg4DecContext --- diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h index 4a5b989..5dc2203 100644 --- a/libavcodec/mpeg4video.h +++ b/libavcodec/mpeg4video.h @@ -67,6 +67,8 @@ typedef struct Mpeg4DecContext { int shape; int vol_sprite_usage; int sprite_brightness_change; + int num_sprite_warping_points; + // reversible vlc int rvlc; ///< could this stream contain resync markers diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 20dd14b..f8bb54c 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -172,7 +172,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g if (w <= 0 || h <= 0) return AVERROR_INVALIDDATA; - for (i = 0; i < s->num_sprite_warping_points; i++) { + for (i = 0; i < ctx->num_sprite_warping_points; i++) { int length; int x = 0, y = 0; @@ -240,7 +240,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][1] - 16 * vop_ref[0][1]) + h2 * (r * sprite_ref[2][1] - 16 * vop_ref[2][1])), h); - switch (s->num_sprite_warping_points) { + switch (ctx->num_sprite_warping_points) { case 0: s->sprite_offset[0][0] = s->sprite_offset[0][1] = @@ -359,7 +359,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g s->sprite_delta[1][i] <<= shift_y; s->sprite_shift[i] = 16; } - s->real_sprite_warping_points = s->num_sprite_warping_points; + s->real_sprite_warping_points = ctx->num_sprite_warping_points; } return 0; @@ -1780,12 +1780,12 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) skip_bits(gb, 13); // sprite_top skip_bits1(gb); /* marker */ } - s->num_sprite_warping_points = get_bits(gb, 6); - if (s->num_sprite_warping_points > 3) { + ctx->num_sprite_warping_points = get_bits(gb, 6); + if (ctx->num_sprite_warping_points > 3) { av_log(s->avctx, AV_LOG_ERROR, "%d sprite_warping_points\n", - s->num_sprite_warping_points); - s->num_sprite_warping_points = 0; + ctx->num_sprite_warping_points); + ctx->num_sprite_warping_points = 0; return -1; } s->sprite_warping_accuracy = get_bits(gb, 2); @@ -2242,7 +2242,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) gb->size_in_bits, s->progressive_sequence, s->alternate_scan, s->top_field_first, s->quarter_sample ? "q" : "h", s->data_partitioning, ctx->resync_marker, - s->num_sprite_warping_points, s->sprite_warping_accuracy, + ctx->num_sprite_warping_points, s->sprite_warping_accuracy, 1 - s->no_rounding, s->vo_type, s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold, ctx->cplx_estimation_trash_i, ctx->cplx_estimation_trash_p, diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 9c245c8..4a4b925 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -579,7 +579,6 @@ typedef struct MpegEncContext { uint16_t pb_time; ///< time distance between the last b and p,s,i frame uint16_t pp_field_time; uint16_t pb_field_time; ///< like above, just for interlaced - int num_sprite_warping_points; int real_sprite_warping_points; uint16_t sprite_traj[4][2]; ///< sprite trajectory points int sprite_offset[2][2]; ///< sprite offset[isChroma][isMVY] diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index f01285a..b661556 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -73,8 +73,8 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ pic_param->vol_fields.bits.data_partitioned = s->data_partitioning; pic_param->vol_fields.bits.reversible_vlc = ctx->rvlc; pic_param->vol_fields.bits.resync_marker_disable = !ctx->resync_marker; - pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points; - for (i = 0; i < s->num_sprite_warping_points && i < 3; i++) { + pic_param->no_of_sprite_warping_points = ctx->num_sprite_warping_points; + for (i = 0; i < ctx->num_sprite_warping_points && i < 3; i++) { pic_param->sprite_trajectory_du[i] = s->sprite_traj[i][0]; pic_param->sprite_trajectory_dv[i] = s->sprite_traj[i][1]; }