Commit 36e2ec40 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'f7d22867'

* commit 'f7d22867':
  mpeg4videodec: move intra_dc_threshold from MpegEncContext to Mpeg4DecContext

Conflicts:
	libavcodec/mpeg4videodec.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents db7580b4 f7d22867
...@@ -84,6 +84,8 @@ typedef struct Mpeg4DecContext { ...@@ -84,6 +84,8 @@ typedef struct Mpeg4DecContext {
int enhancement_type; int enhancement_type;
int scalability; int scalability;
int use_intra_dc_vlc; int use_intra_dc_vlc;
///< QP above whch the ac VLC should be used for intra dc
int intra_dc_threshold;
/* bug workarounds */ /* bug workarounds */
int divx_version; int divx_version;
......
...@@ -1210,7 +1210,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) ...@@ -1210,7 +1210,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64])
mb_type = s->current_picture.mb_type[xy]; mb_type = s->current_picture.mb_type[xy];
cbp = s->cbp_table[xy]; cbp = s->cbp_table[xy];
ctx->use_intra_dc_vlc = s->qscale < s->intra_dc_threshold; ctx->use_intra_dc_vlc = s->qscale < ctx->intra_dc_threshold;
if (s->current_picture.qscale_table[xy] != s->qscale) if (s->current_picture.qscale_table[xy] != s->qscale)
ff_set_qscale(s, s->current_picture.qscale_table[xy]); ff_set_qscale(s, s->current_picture.qscale_table[xy]);
...@@ -1608,7 +1608,7 @@ intra: ...@@ -1608,7 +1608,7 @@ intra:
} }
cbp = (cbpc & 3) | (cbpy << 2); cbp = (cbpc & 3) | (cbpy << 2);
ctx->use_intra_dc_vlc = s->qscale < s->intra_dc_threshold; ctx->use_intra_dc_vlc = s->qscale < ctx->intra_dc_threshold;
if (dquant) if (dquant)
ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]); ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
...@@ -2362,7 +2362,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) ...@@ -2362,7 +2362,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
av_log(s->avctx, AV_LOG_ERROR, "Header truncated\n"); av_log(s->avctx, AV_LOG_ERROR, "Header truncated\n");
return -1; return -1;
} }
s->intra_dc_threshold = ff_mpeg4_dc_threshold[get_bits(gb, 3)]; ctx->intra_dc_threshold = ff_mpeg4_dc_threshold[get_bits(gb, 3)];
if (!s->progressive_sequence) { if (!s->progressive_sequence) {
s->top_field_first = get_bits1(gb); s->top_field_first = get_bits1(gb);
s->alternate_scan = get_bits1(gb); s->alternate_scan = get_bits1(gb);
...@@ -2434,7 +2434,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) ...@@ -2434,7 +2434,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb)
s->data_partitioning, ctx->resync_marker, s->data_partitioning, ctx->resync_marker,
ctx->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" : " ", ctx->intra_dc_threshold,
ctx->cplx_estimation_trash_i, ctx->cplx_estimation_trash_p, ctx->cplx_estimation_trash_i, ctx->cplx_estimation_trash_p,
ctx->cplx_estimation_trash_b, ctx->cplx_estimation_trash_b,
s->time, s->time,
......
...@@ -608,7 +608,6 @@ typedef struct MpegEncContext { ...@@ -608,7 +608,6 @@ typedef struct MpegEncContext {
int low_delay; ///< no reordering needed / has no b-frames int low_delay; ///< no reordering needed / has no b-frames
int vo_type; int vo_type;
int vol_control_parameters; ///< does the stream contain the low_delay flag, used to workaround buggy encoders int vol_control_parameters; ///< does the stream contain the low_delay flag, used to workaround buggy encoders
int intra_dc_threshold; ///< QP above whch the ac VLC should be used for intra dc
PutBitContext tex_pb; ///< used for data partitioned VOPs PutBitContext tex_pb; ///< used for data partitioned VOPs
PutBitContext pb2; ///< used for data partitioned VOPs PutBitContext pb2; ///< used for data partitioned VOPs
int mpeg_quant; int mpeg_quant;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "mpeg4video.h" #include "mpeg4video.h"
/** Reconstruct bitstream intra_dc_vlc_thr */ /** Reconstruct bitstream intra_dc_vlc_thr */
static int mpeg4_get_intra_dc_vlc_thr(MpegEncContext *s) static int mpeg4_get_intra_dc_vlc_thr(Mpeg4DecContext *s)
{ {
switch (s->intra_dc_threshold) { switch (s->intra_dc_threshold) {
case 99: return 0; case 99: return 0;
...@@ -83,7 +83,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ ...@@ -83,7 +83,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_
pic_param->vop_fields.bits.vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I; pic_param->vop_fields.bits.vop_coding_type = s->pict_type - AV_PICTURE_TYPE_I;
pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f.pict_type - AV_PICTURE_TYPE_I : 0; pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == AV_PICTURE_TYPE_B ? s->next_picture.f.pict_type - AV_PICTURE_TYPE_I : 0;
pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding; pic_param->vop_fields.bits.vop_rounding_type = s->no_rounding;
pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(s); pic_param->vop_fields.bits.intra_dc_vlc_thr = mpeg4_get_intra_dc_vlc_thr(ctx);
pic_param->vop_fields.bits.top_field_first = s->top_field_first; pic_param->vop_fields.bits.top_field_first = s->top_field_first;
pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan; pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan;
pic_param->vop_fcode_forward = s->f_code; pic_param->vop_fcode_forward = s->f_code;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment