Commit f8e6293b authored by Ramiro Polla's avatar Ramiro Polla

mlpdec: Split read_matrix_params() into its own function.

Originally committed as revision 18206 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 17a86e87
...@@ -498,31 +498,12 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp, ...@@ -498,31 +498,12 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
return 0; return 0;
} }
/** Read decoding parameters that change more often than those in the restart /** Read parameters for primitive matrices. */
* header. */
static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp, static int read_matrix_params(MLPDecodeContext *m, SubStream *s, GetBitContext *gbp)
unsigned int substr)
{ {
SubStream *s = &m->substream[substr];
unsigned int mat, ch; unsigned int mat, ch;
if (s->param_presence_flags & PARAM_PRESENCE)
if (get_bits1(gbp))
s->param_presence_flags = get_bits(gbp, 8);
if (s->param_presence_flags & PARAM_BLOCKSIZE)
if (get_bits1(gbp)) {
s->blocksize = get_bits(gbp, 9);
if (s->blocksize > MAX_BLOCKSIZE) {
av_log(m->avctx, AV_LOG_ERROR, "block size too large\n");
s->blocksize = 0;
return -1;
}
}
if (s->param_presence_flags & PARAM_MATRIX)
if (get_bits1(gbp)) {
s->num_primitive_matrices = get_bits(gbp, 4); s->num_primitive_matrices = get_bits(gbp, 4);
for (mat = 0; mat < s->num_primitive_matrices; mat++) { for (mat = 0; mat < s->num_primitive_matrices; mat++) {
...@@ -560,6 +541,37 @@ static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp, ...@@ -560,6 +541,37 @@ static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
else else
s->matrix_noise_shift[mat] = 0; s->matrix_noise_shift[mat] = 0;
} }
return 0;
}
/** Read decoding parameters that change more often than those in the restart
* header. */
static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
unsigned int substr)
{
SubStream *s = &m->substream[substr];
unsigned int ch;
if (s->param_presence_flags & PARAM_PRESENCE)
if (get_bits1(gbp))
s->param_presence_flags = get_bits(gbp, 8);
if (s->param_presence_flags & PARAM_BLOCKSIZE)
if (get_bits1(gbp)) {
s->blocksize = get_bits(gbp, 9);
if (s->blocksize > MAX_BLOCKSIZE) {
av_log(m->avctx, AV_LOG_ERROR, "block size too large\n");
s->blocksize = 0;
return -1;
}
}
if (s->param_presence_flags & PARAM_MATRIX)
if (get_bits1(gbp)) {
if (read_matrix_params(m, s, gbp) < 0)
return -1;
} }
if (s->param_presence_flags & PARAM_OUTSHIFT) if (s->param_presence_flags & PARAM_OUTSHIFT)
......
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