mpeg4videodec: move num_sprite_warping_points from MpegEncContext to Mpeg4DecContext

pull/49/head
Anton Khirnov 11 years ago
parent 9ba3fc3e3d
commit 513d849bb6
  1. 2
      libavcodec/mpeg4video.h
  2. 16
      libavcodec/mpeg4videodec.c
  3. 1
      libavcodec/mpegvideo.h
  4. 4
      libavcodec/vaapi_mpeg4.c

@ -67,6 +67,8 @@ typedef struct Mpeg4DecContext {
int shape; int shape;
int vol_sprite_usage; int vol_sprite_usage;
int sprite_brightness_change; int sprite_brightness_change;
int num_sprite_warping_points;
// reversible vlc // reversible vlc
int rvlc; int rvlc;
///< could this stream contain resync markers ///< could this stream contain resync markers

@ -172,7 +172,7 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
if (w <= 0 || h <= 0) if (w <= 0 || h <= 0)
return AVERROR_INVALIDDATA; 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 length;
int x = 0, y = 0; 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]) + 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); 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: case 0:
s->sprite_offset[0][0] = s->sprite_offset[0][0] =
s->sprite_offset[0][1] = 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_delta[1][i] <<= shift_y;
s->sprite_shift[i] = 16; 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; return 0;
@ -1780,12 +1780,12 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
skip_bits(gb, 13); // sprite_top skip_bits(gb, 13); // sprite_top
skip_bits1(gb); /* marker */ skip_bits1(gb); /* marker */
} }
s->num_sprite_warping_points = get_bits(gb, 6); ctx->num_sprite_warping_points = get_bits(gb, 6);
if (s->num_sprite_warping_points > 3) { if (ctx->num_sprite_warping_points > 3) {
av_log(s->avctx, AV_LOG_ERROR, av_log(s->avctx, AV_LOG_ERROR,
"%d sprite_warping_points\n", "%d sprite_warping_points\n",
s->num_sprite_warping_points); ctx->num_sprite_warping_points);
s->num_sprite_warping_points = 0; ctx->num_sprite_warping_points = 0;
return -1; return -1;
} }
s->sprite_warping_accuracy = get_bits(gb, 2); 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, gb->size_in_bits, s->progressive_sequence, s->alternate_scan,
s->top_field_first, s->quarter_sample ? "q" : "h", s->top_field_first, s->quarter_sample ? "q" : "h",
s->data_partitioning, ctx->resync_marker, 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, 1 - s->no_rounding, s->vo_type,
s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold, s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold,
ctx->cplx_estimation_trash_i, ctx->cplx_estimation_trash_p, ctx->cplx_estimation_trash_i, ctx->cplx_estimation_trash_p,

@ -579,7 +579,6 @@ typedef struct MpegEncContext {
uint16_t pb_time; ///< time distance between the last b and p,s,i frame uint16_t pb_time; ///< time distance between the last b and p,s,i frame
uint16_t pp_field_time; uint16_t pp_field_time;
uint16_t pb_field_time; ///< like above, just for interlaced uint16_t pb_field_time; ///< like above, just for interlaced
int num_sprite_warping_points;
int real_sprite_warping_points; int real_sprite_warping_points;
uint16_t sprite_traj[4][2]; ///< sprite trajectory points uint16_t sprite_traj[4][2]; ///< sprite trajectory points
int sprite_offset[2][2]; ///< sprite offset[isChroma][isMVY] int sprite_offset[2][2]; ///< sprite offset[isChroma][isMVY]

@ -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.data_partitioned = s->data_partitioning;
pic_param->vol_fields.bits.reversible_vlc = ctx->rvlc; pic_param->vol_fields.bits.reversible_vlc = ctx->rvlc;
pic_param->vol_fields.bits.resync_marker_disable = !ctx->resync_marker; pic_param->vol_fields.bits.resync_marker_disable = !ctx->resync_marker;
pic_param->no_of_sprite_warping_points = s->num_sprite_warping_points; pic_param->no_of_sprite_warping_points = ctx->num_sprite_warping_points;
for (i = 0; i < s->num_sprite_warping_points && i < 3; i++) { 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_du[i] = s->sprite_traj[i][0];
pic_param->sprite_trajectory_dv[i] = s->sprite_traj[i][1]; pic_param->sprite_trajectory_dv[i] = s->sprite_traj[i][1];
} }

Loading…
Cancel
Save