Commit 410c10f9 authored by thilo.borgmann's avatar thilo.borgmann

Limit the Rice parameter used for progressive decoding in ALS.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21849 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent b7c28021
...@@ -192,6 +192,7 @@ typedef struct { ...@@ -192,6 +192,7 @@ typedef struct {
unsigned int frame_id; ///< the frame ID / number of the current frame unsigned int frame_id; ///< the frame ID / number of the current frame
unsigned int js_switch; ///< if true, joint-stereo decoding is enforced unsigned int js_switch; ///< if true, joint-stereo decoding is enforced
unsigned int num_blocks; ///< number of blocks used in the current frame unsigned int num_blocks; ///< number of blocks used in the current frame
unsigned int s_max; ///< maximum Rice parameter allowed in entropy coding
uint8_t *bgmc_lut; ///< pointer at lookup tables used for BGMC uint8_t *bgmc_lut; ///< pointer at lookup tables used for BGMC
unsigned int *bgmc_lut_status; ///< pointer at lookup table status flags used for BGMC unsigned int *bgmc_lut_status; ///< pointer at lookup table status flags used for BGMC
int ltp_lag_length; ///< number of bits used for ltp lag value int ltp_lag_length; ///< number of bits used for ltp lag value
...@@ -720,9 +721,9 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) ...@@ -720,9 +721,9 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
if (opt_order) if (opt_order)
bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4); bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4);
if (opt_order > 1) if (opt_order > 1)
bd->raw_samples[1] = decode_rice(gb, s[0] + 3); bd->raw_samples[1] = decode_rice(gb, FFMIN(s[0] + 3, ctx->s_max));
if (opt_order > 2) if (opt_order > 2)
bd->raw_samples[2] = decode_rice(gb, s[0] + 1); bd->raw_samples[2] = decode_rice(gb, FFMIN(s[0] + 1, ctx->s_max));
start = FFMIN(opt_order, 3); start = FFMIN(opt_order, 3);
} }
...@@ -1508,6 +1509,11 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -1508,6 +1509,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8; avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
} }
// set maximum Rice parameter for progressive decoding based on resolution
// This is not specified in 14496-3 but actually done by the reference
// codec RM22 revision 2.
ctx->s_max = sconf->resolution > 1 ? 31 : 15;
// set lag value for long-term prediction // set lag value for long-term prediction
ctx->ltp_lag_length = 8 + (avctx->sample_rate >= 96000) + ctx->ltp_lag_length = 8 + (avctx->sample_rate >= 96000) +
(avctx->sample_rate >= 192000); (avctx->sample_rate >= 192000);
......
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