1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

mlpdec: Split read_matrix_params() into its own function.

Originally committed as revision 18206 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Ramiro Polla 2009-03-27 23:32:32 +00:00
parent 17a86e87ab
commit f8e6293bde

View File

@ -498,31 +498,12 @@ static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
return 0;
}
/** Read decoding parameters that change more often than those in the restart
* header. */
/** Read parameters for primitive matrices. */
static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
unsigned int substr)
static int read_matrix_params(MLPDecodeContext *m, SubStream *s, GetBitContext *gbp)
{
SubStream *s = &m->substream[substr];
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);
for (mat = 0; mat < s->num_primitive_matrices; mat++) {
@ -560,6 +541,37 @@ static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
else
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)