mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit '4024b566d664a4b161d677554be52f32e7ad4236'
* commit '4024b566d664a4b161d677554be52f32e7ad4236': golomb: Give svq3_get_se_golomb()/svq3_get_ue_golomb() better names Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
commit
b20fe650ef
@ -151,8 +151,8 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
|
|||||||
/* [DIRAC_STD] 10.3.2 Frame size. frame_size(video_params) */
|
/* [DIRAC_STD] 10.3.2 Frame size. frame_size(video_params) */
|
||||||
/* [DIRAC_STD] custom_dimensions_flag */
|
/* [DIRAC_STD] custom_dimensions_flag */
|
||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
dsh->width = svq3_get_ue_golomb(gb); /* [DIRAC_STD] FRAME_WIDTH */
|
dsh->width = get_interleaved_ue_golomb(gb); /* [DIRAC_STD] FRAME_WIDTH */
|
||||||
dsh->height = svq3_get_ue_golomb(gb); /* [DIRAC_STD] FRAME_HEIGHT */
|
dsh->height = get_interleaved_ue_golomb(gb); /* [DIRAC_STD] FRAME_HEIGHT */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [DIRAC_STD] 10.3.3 Chroma Sampling Format.
|
/* [DIRAC_STD] 10.3.3 Chroma Sampling Format.
|
||||||
@ -160,7 +160,7 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
|
|||||||
/* [DIRAC_STD] custom_chroma_format_flag */
|
/* [DIRAC_STD] custom_chroma_format_flag */
|
||||||
if (get_bits1(gb))
|
if (get_bits1(gb))
|
||||||
/* [DIRAC_STD] CHROMA_FORMAT_INDEX */
|
/* [DIRAC_STD] CHROMA_FORMAT_INDEX */
|
||||||
dsh->chroma_format = svq3_get_ue_golomb(gb);
|
dsh->chroma_format = get_interleaved_ue_golomb(gb);
|
||||||
if (dsh->chroma_format > 2U) {
|
if (dsh->chroma_format > 2U) {
|
||||||
if (log_ctx)
|
if (log_ctx)
|
||||||
av_log(log_ctx, AV_LOG_ERROR, "Unknown chroma format %d\n",
|
av_log(log_ctx, AV_LOG_ERROR, "Unknown chroma format %d\n",
|
||||||
@ -172,22 +172,22 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
|
|||||||
/* [DIRAC_STD] custom_scan_format_flag */
|
/* [DIRAC_STD] custom_scan_format_flag */
|
||||||
if (get_bits1(gb))
|
if (get_bits1(gb))
|
||||||
/* [DIRAC_STD] SOURCE_SAMPLING */
|
/* [DIRAC_STD] SOURCE_SAMPLING */
|
||||||
dsh->interlaced = svq3_get_ue_golomb(gb);
|
dsh->interlaced = get_interleaved_ue_golomb(gb);
|
||||||
if (dsh->interlaced > 1U)
|
if (dsh->interlaced > 1U)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
/* [DIRAC_STD] 10.3.5 Frame Rate. frame_rate(video_params) */
|
/* [DIRAC_STD] 10.3.5 Frame Rate. frame_rate(video_params) */
|
||||||
if (get_bits1(gb)) { /* [DIRAC_STD] custom_frame_rate_flag */
|
if (get_bits1(gb)) { /* [DIRAC_STD] custom_frame_rate_flag */
|
||||||
dsh->frame_rate_index = svq3_get_ue_golomb(gb);
|
dsh->frame_rate_index = get_interleaved_ue_golomb(gb);
|
||||||
|
|
||||||
if (dsh->frame_rate_index > 10U)
|
if (dsh->frame_rate_index > 10U)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (!dsh->frame_rate_index) {
|
if (!dsh->frame_rate_index) {
|
||||||
/* [DIRAC_STD] FRAME_RATE_NUMER */
|
/* [DIRAC_STD] FRAME_RATE_NUMER */
|
||||||
frame_rate.num = svq3_get_ue_golomb(gb);
|
frame_rate.num = get_interleaved_ue_golomb(gb);
|
||||||
/* [DIRAC_STD] FRAME_RATE_DENOM */
|
/* [DIRAC_STD] FRAME_RATE_DENOM */
|
||||||
frame_rate.den = svq3_get_ue_golomb(gb);
|
frame_rate.den = get_interleaved_ue_golomb(gb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* [DIRAC_STD] preset_frame_rate(video_params, index) */
|
/* [DIRAC_STD] preset_frame_rate(video_params, index) */
|
||||||
@ -204,14 +204,14 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
|
|||||||
* pixel_aspect_ratio(video_params) */
|
* pixel_aspect_ratio(video_params) */
|
||||||
if (get_bits1(gb)) { /* [DIRAC_STD] custom_pixel_aspect_ratio_flag */
|
if (get_bits1(gb)) { /* [DIRAC_STD] custom_pixel_aspect_ratio_flag */
|
||||||
/* [DIRAC_STD] index */
|
/* [DIRAC_STD] index */
|
||||||
dsh->aspect_ratio_index = svq3_get_ue_golomb(gb);
|
dsh->aspect_ratio_index = get_interleaved_ue_golomb(gb);
|
||||||
|
|
||||||
if (dsh->aspect_ratio_index > 6U)
|
if (dsh->aspect_ratio_index > 6U)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (!dsh->aspect_ratio_index) {
|
if (!dsh->aspect_ratio_index) {
|
||||||
dsh->sample_aspect_ratio.num = svq3_get_ue_golomb(gb);
|
dsh->sample_aspect_ratio.num = get_interleaved_ue_golomb(gb);
|
||||||
dsh->sample_aspect_ratio.den = svq3_get_ue_golomb(gb);
|
dsh->sample_aspect_ratio.den = get_interleaved_ue_golomb(gb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* [DIRAC_STD] Take value from Table 10.4 Available preset pixel
|
/* [DIRAC_STD] Take value from Table 10.4 Available preset pixel
|
||||||
@ -223,13 +223,13 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
|
|||||||
/* [DIRAC_STD] 10.3.7 Clean area. clean_area(video_params) */
|
/* [DIRAC_STD] 10.3.7 Clean area. clean_area(video_params) */
|
||||||
if (get_bits1(gb)) { /* [DIRAC_STD] custom_clean_area_flag */
|
if (get_bits1(gb)) { /* [DIRAC_STD] custom_clean_area_flag */
|
||||||
/* [DIRAC_STD] CLEAN_WIDTH */
|
/* [DIRAC_STD] CLEAN_WIDTH */
|
||||||
dsh->clean_width = svq3_get_ue_golomb(gb);
|
dsh->clean_width = get_interleaved_ue_golomb(gb);
|
||||||
/* [DIRAC_STD] CLEAN_HEIGHT */
|
/* [DIRAC_STD] CLEAN_HEIGHT */
|
||||||
dsh->clean_height = svq3_get_ue_golomb(gb);
|
dsh->clean_height = get_interleaved_ue_golomb(gb);
|
||||||
/* [DIRAC_STD] CLEAN_LEFT_OFFSET */
|
/* [DIRAC_STD] CLEAN_LEFT_OFFSET */
|
||||||
dsh->clean_left_offset = svq3_get_ue_golomb(gb);
|
dsh->clean_left_offset = get_interleaved_ue_golomb(gb);
|
||||||
/* [DIRAC_STD] CLEAN_RIGHT_OFFSET */
|
/* [DIRAC_STD] CLEAN_RIGHT_OFFSET */
|
||||||
dsh->clean_right_offset = svq3_get_ue_golomb(gb);
|
dsh->clean_right_offset = get_interleaved_ue_golomb(gb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [DIRAC_STD] 10.3.8 Signal range. signal_range(video_params)
|
/* [DIRAC_STD] 10.3.8 Signal range. signal_range(video_params)
|
||||||
@ -237,17 +237,17 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
|
|||||||
* AVCOL_RANGE_MPEG/JPEG values */
|
* AVCOL_RANGE_MPEG/JPEG values */
|
||||||
if (get_bits1(gb)) { /* [DIRAC_STD] custom_signal_range_flag */
|
if (get_bits1(gb)) { /* [DIRAC_STD] custom_signal_range_flag */
|
||||||
/* [DIRAC_STD] index */
|
/* [DIRAC_STD] index */
|
||||||
dsh->pixel_range_index = svq3_get_ue_golomb(gb);
|
dsh->pixel_range_index = get_interleaved_ue_golomb(gb);
|
||||||
|
|
||||||
if (dsh->pixel_range_index > 4U)
|
if (dsh->pixel_range_index > 4U)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
/* This assumes either fullrange or MPEG levels only */
|
/* This assumes either fullrange or MPEG levels only */
|
||||||
if (!dsh->pixel_range_index) {
|
if (!dsh->pixel_range_index) {
|
||||||
luma_offset = svq3_get_ue_golomb(gb);
|
luma_offset = get_interleaved_ue_golomb(gb);
|
||||||
luma_depth = av_log2(svq3_get_ue_golomb(gb)) + 1;
|
luma_depth = av_log2(get_interleaved_ue_golomb(gb)) + 1;
|
||||||
svq3_get_ue_golomb(gb); /* chroma offset */
|
get_interleaved_ue_golomb(gb); /* chroma offset */
|
||||||
svq3_get_ue_golomb(gb); /* chroma excursion */
|
get_interleaved_ue_golomb(gb); /* chroma excursion */
|
||||||
dsh->color_range = luma_offset ? AVCOL_RANGE_MPEG
|
dsh->color_range = luma_offset ? AVCOL_RANGE_MPEG
|
||||||
: AVCOL_RANGE_JPEG;
|
: AVCOL_RANGE_JPEG;
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
|
|||||||
/* [DIRAC_STD] 10.3.9 Colour specification. colour_spec(video_params) */
|
/* [DIRAC_STD] 10.3.9 Colour specification. colour_spec(video_params) */
|
||||||
if (get_bits1(gb)) { /* [DIRAC_STD] custom_colour_spec_flag */
|
if (get_bits1(gb)) { /* [DIRAC_STD] custom_colour_spec_flag */
|
||||||
/* [DIRAC_STD] index */
|
/* [DIRAC_STD] index */
|
||||||
idx = dsh->color_spec_index = svq3_get_ue_golomb(gb);
|
idx = dsh->color_spec_index = get_interleaved_ue_golomb(gb);
|
||||||
|
|
||||||
if (dsh->color_spec_index > 4U)
|
if (dsh->color_spec_index > 4U)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -291,20 +291,20 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
|
|||||||
if (!dsh->color_spec_index) {
|
if (!dsh->color_spec_index) {
|
||||||
/* [DIRAC_STD] 10.3.9.1 Colour primaries */
|
/* [DIRAC_STD] 10.3.9.1 Colour primaries */
|
||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
idx = svq3_get_ue_golomb(gb);
|
idx = get_interleaved_ue_golomb(gb);
|
||||||
if (idx < 3U)
|
if (idx < 3U)
|
||||||
dsh->color_primaries = dirac_primaries[idx];
|
dsh->color_primaries = dirac_primaries[idx];
|
||||||
}
|
}
|
||||||
/* [DIRAC_STD] 10.3.9.2 Colour matrix */
|
/* [DIRAC_STD] 10.3.9.2 Colour matrix */
|
||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
idx = svq3_get_ue_golomb(gb);
|
idx = get_interleaved_ue_golomb(gb);
|
||||||
if (!idx)
|
if (!idx)
|
||||||
dsh->colorspace = AVCOL_SPC_BT709;
|
dsh->colorspace = AVCOL_SPC_BT709;
|
||||||
else if (idx == 1)
|
else if (idx == 1)
|
||||||
dsh->colorspace = AVCOL_SPC_BT470BG;
|
dsh->colorspace = AVCOL_SPC_BT470BG;
|
||||||
}
|
}
|
||||||
/* [DIRAC_STD] 10.3.9.3 Transfer function */
|
/* [DIRAC_STD] 10.3.9.3 Transfer function */
|
||||||
if (get_bits1(gb) && !svq3_get_ue_golomb(gb))
|
if (get_bits1(gb) && !get_interleaved_ue_golomb(gb))
|
||||||
dsh->color_trc = AVCOL_TRC_BT709;
|
dsh->color_trc = AVCOL_TRC_BT709;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -336,13 +336,13 @@ int av_dirac_parse_sequence_header(AVDiracSeqHeader **pdsh,
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* [DIRAC_SPEC] 10.1 Parse Parameters. parse_parameters() */
|
/* [DIRAC_SPEC] 10.1 Parse Parameters. parse_parameters() */
|
||||||
dsh->version.major = svq3_get_ue_golomb(&gb);
|
dsh->version.major = get_interleaved_ue_golomb(&gb);
|
||||||
dsh->version.minor = svq3_get_ue_golomb(&gb);
|
dsh->version.minor = get_interleaved_ue_golomb(&gb);
|
||||||
dsh->profile = svq3_get_ue_golomb(&gb);
|
dsh->profile = get_interleaved_ue_golomb(&gb);
|
||||||
dsh->level = svq3_get_ue_golomb(&gb);
|
dsh->level = get_interleaved_ue_golomb(&gb);
|
||||||
/* [DIRAC_SPEC] sequence_header() -> base_video_format as defined in
|
/* [DIRAC_SPEC] sequence_header() -> base_video_format as defined in
|
||||||
* 10.2 Base Video Format, table 10.1 Dirac predefined video formats */
|
* 10.2 Base Video Format, table 10.1 Dirac predefined video formats */
|
||||||
video_format = svq3_get_ue_golomb(&gb);
|
video_format = get_interleaved_ue_golomb(&gb);
|
||||||
|
|
||||||
if (dsh->version.major < 2 && log_ctx)
|
if (dsh->version.major < 2 && log_ctx)
|
||||||
av_log(log_ctx, AV_LOG_WARNING, "Stream is old and may not work\n");
|
av_log(log_ctx, AV_LOG_WARNING, "Stream is old and may not work\n");
|
||||||
@ -377,7 +377,7 @@ int av_dirac_parse_sequence_header(AVDiracSeqHeader **pdsh,
|
|||||||
|
|
||||||
/* [DIRAC_STD] picture_coding_mode shall be 0 for fields and 1 for frames
|
/* [DIRAC_STD] picture_coding_mode shall be 0 for fields and 1 for frames
|
||||||
* currently only used to signal field coding */
|
* currently only used to signal field coding */
|
||||||
picture_coding_mode = svq3_get_ue_golomb(&gb);
|
picture_coding_mode = get_interleaved_ue_golomb(&gb);
|
||||||
if (picture_coding_mode != 0) {
|
if (picture_coding_mode != 0) {
|
||||||
if (log_ctx) {
|
if (log_ctx) {
|
||||||
av_log(log_ctx, AV_LOG_ERROR, "Unsupported picture coding mode %d",
|
av_log(log_ctx, AV_LOG_ERROR, "Unsupported picture coding mode %d",
|
||||||
|
@ -671,9 +671,9 @@ static void decode_component(DiracContext *s, int comp)
|
|||||||
|
|
||||||
align_get_bits(&s->gb);
|
align_get_bits(&s->gb);
|
||||||
/* [DIRAC_STD] 13.4.2 subband() */
|
/* [DIRAC_STD] 13.4.2 subband() */
|
||||||
b->length = svq3_get_ue_golomb(&s->gb);
|
b->length = get_interleaved_ue_golomb(&s->gb);
|
||||||
if (b->length) {
|
if (b->length) {
|
||||||
b->quant = svq3_get_ue_golomb(&s->gb);
|
b->quant = get_interleaved_ue_golomb(&s->gb);
|
||||||
align_get_bits(&s->gb);
|
align_get_bits(&s->gb);
|
||||||
b->coeff_data = s->gb.buffer + get_bits_count(&s->gb)/8;
|
b->coeff_data = s->gb.buffer + get_bits_count(&s->gb)/8;
|
||||||
b->length = FFMIN(b->length, FFMAX(get_bits_left(&s->gb)/8, 0));
|
b->length = FFMIN(b->length, FFMAX(get_bits_left(&s->gb)/8, 0));
|
||||||
@ -1001,7 +1001,7 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
|||||||
align_get_bits(gb);
|
align_get_bits(gb);
|
||||||
/* [DIRAC_STD] 11.2.2 Block parameters. block_parameters() */
|
/* [DIRAC_STD] 11.2.2 Block parameters. block_parameters() */
|
||||||
/* Luma and Chroma are equal. 11.2.3 */
|
/* Luma and Chroma are equal. 11.2.3 */
|
||||||
idx = svq3_get_ue_golomb(gb); /* [DIRAC_STD] index */
|
idx = get_interleaved_ue_golomb(gb); /* [DIRAC_STD] index */
|
||||||
|
|
||||||
if (idx > 4) {
|
if (idx > 4) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Block prediction index too high\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Block prediction index too high\n");
|
||||||
@ -1009,10 +1009,10 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
s->plane[0].xblen = svq3_get_ue_golomb(gb);
|
s->plane[0].xblen = get_interleaved_ue_golomb(gb);
|
||||||
s->plane[0].yblen = svq3_get_ue_golomb(gb);
|
s->plane[0].yblen = get_interleaved_ue_golomb(gb);
|
||||||
s->plane[0].xbsep = svq3_get_ue_golomb(gb);
|
s->plane[0].xbsep = get_interleaved_ue_golomb(gb);
|
||||||
s->plane[0].ybsep = svq3_get_ue_golomb(gb);
|
s->plane[0].ybsep = get_interleaved_ue_golomb(gb);
|
||||||
} else {
|
} else {
|
||||||
/*[DIRAC_STD] preset_block_params(index). Table 11.1 */
|
/*[DIRAC_STD] preset_block_params(index). Table 11.1 */
|
||||||
s->plane[0].xblen = default_blen[idx-1];
|
s->plane[0].xblen = default_blen[idx-1];
|
||||||
@ -1046,7 +1046,7 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
|||||||
|
|
||||||
/*[DIRAC_STD] 11.2.5 Motion vector precision. motion_vector_precision()
|
/*[DIRAC_STD] 11.2.5 Motion vector precision. motion_vector_precision()
|
||||||
Read motion vector precision */
|
Read motion vector precision */
|
||||||
s->mv_precision = svq3_get_ue_golomb(gb);
|
s->mv_precision = get_interleaved_ue_golomb(gb);
|
||||||
if (s->mv_precision > 3) {
|
if (s->mv_precision > 3) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "MV precision finer than eighth-pel\n");
|
av_log(s->avctx, AV_LOG_ERROR, "MV precision finer than eighth-pel\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -1066,7 +1066,7 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
|||||||
/* [DIRAC_STD] zoom_rotate_shear(gparams)
|
/* [DIRAC_STD] zoom_rotate_shear(gparams)
|
||||||
zoom/rotation/shear parameters */
|
zoom/rotation/shear parameters */
|
||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
s->globalmc[ref].zrs_exp = svq3_get_ue_golomb(gb);
|
s->globalmc[ref].zrs_exp = get_interleaved_ue_golomb(gb);
|
||||||
s->globalmc[ref].zrs[0][0] = dirac_get_se_golomb(gb);
|
s->globalmc[ref].zrs[0][0] = dirac_get_se_golomb(gb);
|
||||||
s->globalmc[ref].zrs[0][1] = dirac_get_se_golomb(gb);
|
s->globalmc[ref].zrs[0][1] = dirac_get_se_golomb(gb);
|
||||||
s->globalmc[ref].zrs[1][0] = dirac_get_se_golomb(gb);
|
s->globalmc[ref].zrs[1][0] = dirac_get_se_golomb(gb);
|
||||||
@ -1077,7 +1077,7 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
|||||||
}
|
}
|
||||||
/* [DIRAC_STD] perspective(gparams) */
|
/* [DIRAC_STD] perspective(gparams) */
|
||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
s->globalmc[ref].perspective_exp = svq3_get_ue_golomb(gb);
|
s->globalmc[ref].perspective_exp = get_interleaved_ue_golomb(gb);
|
||||||
s->globalmc[ref].perspective[0] = dirac_get_se_golomb(gb);
|
s->globalmc[ref].perspective[0] = dirac_get_se_golomb(gb);
|
||||||
s->globalmc[ref].perspective[1] = dirac_get_se_golomb(gb);
|
s->globalmc[ref].perspective[1] = dirac_get_se_golomb(gb);
|
||||||
}
|
}
|
||||||
@ -1086,7 +1086,7 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
|||||||
|
|
||||||
/*[DIRAC_STD] 11.2.7 Picture prediction mode. prediction_mode()
|
/*[DIRAC_STD] 11.2.7 Picture prediction mode. prediction_mode()
|
||||||
Picture prediction mode, not currently used. */
|
Picture prediction mode, not currently used. */
|
||||||
if (svq3_get_ue_golomb(gb)) {
|
if (get_interleaved_ue_golomb(gb)) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Unknown picture prediction mode\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Unknown picture prediction mode\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
@ -1098,7 +1098,7 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
|
|||||||
s->weight[1] = 1;
|
s->weight[1] = 1;
|
||||||
|
|
||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
s->weight_log2denom = svq3_get_ue_golomb(gb);
|
s->weight_log2denom = get_interleaved_ue_golomb(gb);
|
||||||
s->weight[0] = dirac_get_se_golomb(gb);
|
s->weight[0] = dirac_get_se_golomb(gb);
|
||||||
if (s->num_refs == 2)
|
if (s->num_refs == 2)
|
||||||
s->weight[1] = dirac_get_se_golomb(gb);
|
s->weight[1] = dirac_get_se_golomb(gb);
|
||||||
@ -1117,7 +1117,7 @@ static int dirac_unpack_idwt_params(DiracContext *s)
|
|||||||
unsigned tmp;
|
unsigned tmp;
|
||||||
|
|
||||||
#define CHECKEDREAD(dst, cond, errmsg) \
|
#define CHECKEDREAD(dst, cond, errmsg) \
|
||||||
tmp = svq3_get_ue_golomb(gb); \
|
tmp = get_interleaved_ue_golomb(gb); \
|
||||||
if (cond) { \
|
if (cond) { \
|
||||||
av_log(s->avctx, AV_LOG_ERROR, errmsg); \
|
av_log(s->avctx, AV_LOG_ERROR, errmsg); \
|
||||||
return AVERROR_INVALIDDATA; \
|
return AVERROR_INVALIDDATA; \
|
||||||
@ -1151,18 +1151,18 @@ static int dirac_unpack_idwt_params(DiracContext *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s->num_x = svq3_get_ue_golomb(gb);
|
s->num_x = get_interleaved_ue_golomb(gb);
|
||||||
s->num_y = svq3_get_ue_golomb(gb);
|
s->num_y = get_interleaved_ue_golomb(gb);
|
||||||
if (s->ld_picture) {
|
if (s->ld_picture) {
|
||||||
s->lowdelay.bytes.num = svq3_get_ue_golomb(gb);
|
s->lowdelay.bytes.num = get_interleaved_ue_golomb(gb);
|
||||||
s->lowdelay.bytes.den = svq3_get_ue_golomb(gb);
|
s->lowdelay.bytes.den = get_interleaved_ue_golomb(gb);
|
||||||
if (s->lowdelay.bytes.den <= 0) {
|
if (s->lowdelay.bytes.den <= 0) {
|
||||||
av_log(s->avctx,AV_LOG_ERROR,"Invalid lowdelay.bytes.den\n");
|
av_log(s->avctx,AV_LOG_ERROR,"Invalid lowdelay.bytes.den\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
} else if (s->hq_picture) {
|
} else if (s->hq_picture) {
|
||||||
s->highquality.prefix_bytes = svq3_get_ue_golomb(gb);
|
s->highquality.prefix_bytes = get_interleaved_ue_golomb(gb);
|
||||||
s->highquality.size_scaler = svq3_get_ue_golomb(gb);
|
s->highquality.size_scaler = get_interleaved_ue_golomb(gb);
|
||||||
if (s->highquality.prefix_bytes >= INT_MAX / 8) {
|
if (s->highquality.prefix_bytes >= INT_MAX / 8) {
|
||||||
av_log(s->avctx,AV_LOG_ERROR,"too many prefix bytes\n");
|
av_log(s->avctx,AV_LOG_ERROR,"too many prefix bytes\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -1173,11 +1173,11 @@ static int dirac_unpack_idwt_params(DiracContext *s)
|
|||||||
if (get_bits1(gb)) {
|
if (get_bits1(gb)) {
|
||||||
av_log(s->avctx,AV_LOG_DEBUG,"Low Delay: Has Custom Quantization Matrix!\n");
|
av_log(s->avctx,AV_LOG_DEBUG,"Low Delay: Has Custom Quantization Matrix!\n");
|
||||||
/* custom quantization matrix */
|
/* custom quantization matrix */
|
||||||
s->lowdelay.quant[0][0] = svq3_get_ue_golomb(gb);
|
s->lowdelay.quant[0][0] = get_interleaved_ue_golomb(gb);
|
||||||
for (level = 0; level < s->wavelet_depth; level++) {
|
for (level = 0; level < s->wavelet_depth; level++) {
|
||||||
s->lowdelay.quant[level][1] = svq3_get_ue_golomb(gb);
|
s->lowdelay.quant[level][1] = get_interleaved_ue_golomb(gb);
|
||||||
s->lowdelay.quant[level][2] = svq3_get_ue_golomb(gb);
|
s->lowdelay.quant[level][2] = get_interleaved_ue_golomb(gb);
|
||||||
s->lowdelay.quant[level][3] = svq3_get_ue_golomb(gb);
|
s->lowdelay.quant[level][3] = get_interleaved_ue_golomb(gb);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (s->wavelet_depth > 4) {
|
if (s->wavelet_depth > 4) {
|
||||||
@ -1388,7 +1388,7 @@ static int dirac_unpack_block_motion_data(DiracContext *s)
|
|||||||
|
|
||||||
/* [DIRAC_STD] 12.3.1 Superblock splitting modes. superblock_split_modes()
|
/* [DIRAC_STD] 12.3.1 Superblock splitting modes. superblock_split_modes()
|
||||||
decode superblock split modes */
|
decode superblock split modes */
|
||||||
ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); /* svq3_get_ue_golomb(gb) is the length */
|
ff_dirac_init_arith_decoder(arith, gb, get_interleaved_ue_golomb(gb)); /* get_interleaved_ue_golomb(gb) is the length */
|
||||||
for (y = 0; y < s->sbheight; y++) {
|
for (y = 0; y < s->sbheight; y++) {
|
||||||
for (x = 0; x < s->sbwidth; x++) {
|
for (x = 0; x < s->sbwidth; x++) {
|
||||||
unsigned int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA);
|
unsigned int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA);
|
||||||
@ -1400,13 +1400,13 @@ static int dirac_unpack_block_motion_data(DiracContext *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* setup arith decoding */
|
/* setup arith decoding */
|
||||||
ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb));
|
ff_dirac_init_arith_decoder(arith, gb, get_interleaved_ue_golomb(gb));
|
||||||
for (i = 0; i < s->num_refs; i++) {
|
for (i = 0; i < s->num_refs; i++) {
|
||||||
ff_dirac_init_arith_decoder(arith + 4 + 2 * i, gb, svq3_get_ue_golomb(gb));
|
ff_dirac_init_arith_decoder(arith + 4 + 2 * i, gb, get_interleaved_ue_golomb(gb));
|
||||||
ff_dirac_init_arith_decoder(arith + 5 + 2 * i, gb, svq3_get_ue_golomb(gb));
|
ff_dirac_init_arith_decoder(arith + 5 + 2 * i, gb, get_interleaved_ue_golomb(gb));
|
||||||
}
|
}
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
ff_dirac_init_arith_decoder(arith+1+i, gb, svq3_get_ue_golomb(gb));
|
ff_dirac_init_arith_decoder(arith+1+i, gb, get_interleaved_ue_golomb(gb));
|
||||||
|
|
||||||
for (y = 0; y < s->sbheight; y++)
|
for (y = 0; y < s->sbheight; y++)
|
||||||
for (x = 0; x < s->sbwidth; x++) {
|
for (x = 0; x < s->sbwidth; x++) {
|
||||||
|
@ -112,7 +112,7 @@ static inline int get_ue_golomb_31(GetBitContext *gb)
|
|||||||
return ff_ue_golomb_vlc_code[buf];
|
return ff_ue_golomb_vlc_code[buf];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned svq3_get_ue_golomb(GetBitContext *gb)
|
static inline unsigned get_interleaved_ue_golomb(GetBitContext *gb)
|
||||||
{
|
{
|
||||||
uint32_t buf;
|
uint32_t buf;
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ static inline int get_se_golomb_long(GetBitContext *gb)
|
|||||||
return ((buf >> 1) ^ sign) + 1;
|
return ((buf >> 1) ^ sign) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int svq3_get_se_golomb(GetBitContext *gb)
|
static inline int get_interleaved_se_golomb(GetBitContext *gb)
|
||||||
{
|
{
|
||||||
unsigned int buf;
|
unsigned int buf;
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ static inline int svq3_get_se_golomb(GetBitContext *gb)
|
|||||||
|
|
||||||
static inline int dirac_get_se_golomb(GetBitContext *gb)
|
static inline int dirac_get_se_golomb(GetBitContext *gb)
|
||||||
{
|
{
|
||||||
uint32_t ret = svq3_get_ue_golomb(gb);
|
uint32_t ret = get_interleaved_ue_golomb(gb);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
int sign = -get_bits1(gb);
|
int sign = -get_bits1(gb);
|
||||||
|
@ -89,7 +89,7 @@ static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t
|
|||||||
|
|
||||||
for(i = 0; i < 4; i++, dst += r->intra_types_stride - 4){
|
for(i = 0; i < 4; i++, dst += r->intra_types_stride - 4){
|
||||||
for(j = 0; j < 4; j+= 2){
|
for(j = 0; j < 4; j+= 2){
|
||||||
unsigned code = svq3_get_ue_golomb(gb) << 1;
|
unsigned code = get_interleaved_ue_golomb(gb) << 1;
|
||||||
if (code > 80U*2U) {
|
if (code > 80U*2U) {
|
||||||
av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction code\n");
|
av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction code\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -117,7 +117,7 @@ static int rv30_decode_mb_info(RV34DecContext *r)
|
|||||||
static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
|
static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
|
||||||
MpegEncContext *s = &r->s;
|
MpegEncContext *s = &r->s;
|
||||||
GetBitContext *gb = &s->gb;
|
GetBitContext *gb = &s->gb;
|
||||||
unsigned code = svq3_get_ue_golomb(gb);
|
unsigned code = get_interleaved_ue_golomb(gb);
|
||||||
|
|
||||||
if (code > 11) {
|
if (code > 11) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "Incorrect MB type code\n");
|
av_log(s->avctx, AV_LOG_ERROR, "Incorrect MB type code\n");
|
||||||
|
@ -864,8 +864,8 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type)
|
|||||||
|
|
||||||
memset(r->dmv, 0, sizeof(r->dmv));
|
memset(r->dmv, 0, sizeof(r->dmv));
|
||||||
for(i = 0; i < num_mvs[block_type]; i++){
|
for(i = 0; i < num_mvs[block_type]; i++){
|
||||||
r->dmv[i][0] = svq3_get_se_golomb(gb);
|
r->dmv[i][0] = get_interleaved_se_golomb(gb);
|
||||||
r->dmv[i][1] = svq3_get_se_golomb(gb);
|
r->dmv[i][1] = get_interleaved_se_golomb(gb);
|
||||||
}
|
}
|
||||||
switch(block_type){
|
switch(block_type){
|
||||||
case RV34_MB_TYPE_INTRA:
|
case RV34_MB_TYPE_INTRA:
|
||||||
|
@ -231,7 +231,7 @@ static int rv40_decode_mb_info(RV34DecContext *r)
|
|||||||
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
|
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
|
||||||
|
|
||||||
if(!r->s.mb_skip_run) {
|
if(!r->s.mb_skip_run) {
|
||||||
r->s.mb_skip_run = svq3_get_ue_golomb(gb) + 1;
|
r->s.mb_skip_run = get_interleaved_ue_golomb(gb) + 1;
|
||||||
if(r->s.mb_skip_run > (unsigned)s->mb_num)
|
if(r->s.mb_skip_run > (unsigned)s->mb_num)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ static inline int svq3_decode_block(GetBitContext *gb, int16_t *block,
|
|||||||
const uint8_t *const scan = scan_patterns[type];
|
const uint8_t *const scan = scan_patterns[type];
|
||||||
|
|
||||||
for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
|
for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
|
||||||
for (; (vlc = svq3_get_ue_golomb(gb)) != 0; index++) {
|
for (; (vlc = get_interleaved_ue_golomb(gb)) != 0; index++) {
|
||||||
if ((int32_t)vlc < 0)
|
if ((int32_t)vlc < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -534,8 +534,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
|
|||||||
if (mode == PREDICT_MODE) {
|
if (mode == PREDICT_MODE) {
|
||||||
dx = dy = 0;
|
dx = dy = 0;
|
||||||
} else {
|
} else {
|
||||||
dy = svq3_get_se_golomb(&s->gb_slice);
|
dy = get_interleaved_se_golomb(&s->gb_slice);
|
||||||
dx = svq3_get_se_golomb(&s->gb_slice);
|
dx = get_interleaved_se_golomb(&s->gb_slice);
|
||||||
|
|
||||||
if (dx == INVALID_VLC || dy == INVALID_VLC) {
|
if (dx == INVALID_VLC || dy == INVALID_VLC) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "invalid MV vlc\n");
|
av_log(s->avctx, AV_LOG_ERROR, "invalid MV vlc\n");
|
||||||
@ -846,7 +846,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
|
|||||||
|
|
||||||
/* decode prediction codes for luma blocks */
|
/* decode prediction codes for luma blocks */
|
||||||
for (i = 0; i < 16; i += 2) {
|
for (i = 0; i < 16; i += 2) {
|
||||||
vlc = svq3_get_ue_golomb(&s->gb_slice);
|
vlc = get_interleaved_ue_golomb(&s->gb_slice);
|
||||||
|
|
||||||
if (vlc >= 25U) {
|
if (vlc >= 25U) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR,
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
@ -924,7 +924,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
|
|||||||
|
|
||||||
if (!IS_INTRA16x16(mb_type) &&
|
if (!IS_INTRA16x16(mb_type) &&
|
||||||
(!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) {
|
(!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) {
|
||||||
if ((vlc = svq3_get_ue_golomb(&s->gb_slice)) >= 48U){
|
if ((vlc = get_interleaved_ue_golomb(&s->gb_slice)) >= 48U){
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "cbp_vlc=%"PRIu32"\n", vlc);
|
av_log(s->avctx, AV_LOG_ERROR, "cbp_vlc=%"PRIu32"\n", vlc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -934,7 +934,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
|
|||||||
}
|
}
|
||||||
if (IS_INTRA16x16(mb_type) ||
|
if (IS_INTRA16x16(mb_type) ||
|
||||||
(s->pict_type != AV_PICTURE_TYPE_I && s->adaptive_quant && cbp)) {
|
(s->pict_type != AV_PICTURE_TYPE_I && s->adaptive_quant && cbp)) {
|
||||||
s->qscale += svq3_get_se_golomb(&s->gb_slice);
|
s->qscale += get_interleaved_se_golomb(&s->gb_slice);
|
||||||
|
|
||||||
if (s->qscale > 31u) {
|
if (s->qscale > 31u) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale);
|
av_log(s->avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale);
|
||||||
@ -1052,7 +1052,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
|
|||||||
skip_bits_long(&s->gb, slice_bytes * 8);
|
skip_bits_long(&s->gb, slice_bytes * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((slice_id = svq3_get_ue_golomb(&s->gb_slice)) >= 3) {
|
if ((slice_id = get_interleaved_ue_golomb(&s->gb_slice)) >= 3) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "illegal slice type %u \n", slice_id);
|
av_log(s->avctx, AV_LOG_ERROR, "illegal slice type %u \n", slice_id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1245,12 +1245,12 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx)
|
|||||||
avctx->has_b_frames = !s->low_delay;
|
avctx->has_b_frames = !s->low_delay;
|
||||||
if (s->has_watermark) {
|
if (s->has_watermark) {
|
||||||
#if CONFIG_ZLIB
|
#if CONFIG_ZLIB
|
||||||
unsigned watermark_width = svq3_get_ue_golomb(&gb);
|
unsigned watermark_width = get_interleaved_ue_golomb(&gb);
|
||||||
unsigned watermark_height = svq3_get_ue_golomb(&gb);
|
unsigned watermark_height = get_interleaved_ue_golomb(&gb);
|
||||||
int u1 = svq3_get_ue_golomb(&gb);
|
int u1 = get_interleaved_ue_golomb(&gb);
|
||||||
int u2 = get_bits(&gb, 8);
|
int u2 = get_bits(&gb, 8);
|
||||||
int u3 = get_bits(&gb, 2);
|
int u3 = get_bits(&gb, 2);
|
||||||
int u4 = svq3_get_ue_golomb(&gb);
|
int u4 = get_interleaved_ue_golomb(&gb);
|
||||||
unsigned long buf_len = watermark_width *
|
unsigned long buf_len = watermark_width *
|
||||||
watermark_height * 4;
|
watermark_height * 4;
|
||||||
int offset = get_bits_count(&gb) + 7 >> 3;
|
int offset = get_bits_count(&gb) + 7 >> 3;
|
||||||
@ -1542,7 +1542,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
/* TODO: support s->mb_skip_run */
|
/* TODO: support s->mb_skip_run */
|
||||||
}
|
}
|
||||||
|
|
||||||
mb_type = svq3_get_ue_golomb(&s->gb_slice);
|
mb_type = get_interleaved_ue_golomb(&s->gb_slice);
|
||||||
|
|
||||||
if (s->pict_type == AV_PICTURE_TYPE_I)
|
if (s->pict_type == AV_PICTURE_TYPE_I)
|
||||||
mb_type += 8;
|
mb_type += 8;
|
||||||
|
@ -60,19 +60,19 @@ static void send_picture(AVFormatContext *ctx, const uint8_t *buf, int size, int
|
|||||||
second_field = interlaced && (pic_nr & 0x01);
|
second_field = interlaced && (pic_nr & 0x01);
|
||||||
|
|
||||||
init_get_bits(&gc, buf, 8 * size);
|
init_get_bits(&gc, buf, 8 * size);
|
||||||
svq3_get_ue_golomb(&gc); /* wavelet_idx */
|
get_interleaved_ue_golomb(&gc); /* wavelet_idx */
|
||||||
wavelet_depth = svq3_get_ue_golomb(&gc);
|
wavelet_depth = get_interleaved_ue_golomb(&gc);
|
||||||
svq3_get_ue_golomb(&gc); /* num_x */
|
get_interleaved_ue_golomb(&gc); /* num_x */
|
||||||
svq3_get_ue_golomb(&gc); /* num_y */
|
get_interleaved_ue_golomb(&gc); /* num_y */
|
||||||
prefix_bytes = svq3_get_ue_golomb(&gc);
|
prefix_bytes = get_interleaved_ue_golomb(&gc);
|
||||||
size_scaler = svq3_get_ue_golomb(&gc);
|
size_scaler = get_interleaved_ue_golomb(&gc);
|
||||||
/* pass the quantization matrices */
|
/* pass the quantization matrices */
|
||||||
svq3_get_ue_golomb(&gc);
|
get_interleaved_ue_golomb(&gc);
|
||||||
for(lvl = 0; lvl < wavelet_depth; lvl++)
|
for(lvl = 0; lvl < wavelet_depth; lvl++)
|
||||||
{
|
{
|
||||||
svq3_get_ue_golomb(&gc);
|
get_interleaved_ue_golomb(&gc);
|
||||||
svq3_get_ue_golomb(&gc);
|
get_interleaved_ue_golomb(&gc);
|
||||||
svq3_get_ue_golomb(&gc);
|
get_interleaved_ue_golomb(&gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
frag_len = (get_bits_count(&gc) + 7) / 8; /* length of transform parameters */
|
frag_len = (get_bits_count(&gc) + 7) / 8; /* length of transform parameters */
|
||||||
|
Loading…
Reference in New Issue
Block a user