"Ronald S. Bultje" <[email protected]> writes: > Prevent values in floor1[] from wrapping over uint16_t boundaries (in > crafted bitstreams, they can go < 0), which causes them to wrap to > MAXUINT16, causing huge jumps in the dB LUT indexes. Likewise, clip > (rather than wrap) dB LUT indexes, to prevent jumping of indexes at > uint8_t wrapping boundaries. > --- > libavcodec/vorbis.c | 16 ++++++++-------- > libavcodec/vorbisdec.c | 10 +++++----- > 2 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c > index 0b26870..654de6f 100644 > --- a/libavcodec/vorbis.c > +++ b/libavcodec/vorbis.c > @@ -152,7 +152,7 @@ void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * > list, int values) > } > } > > -static inline void render_line_unrolled(intptr_t x, uint8_t y, int x1, > +static inline void render_line_unrolled(intptr_t x, int y, int x1, > intptr_t sy, int ady, int adx, > float *buf) > { > @@ -164,30 +164,30 @@ static inline void render_line_unrolled(intptr_t x, > uint8_t y, int x1, > if (err >= 0) { > err += ady - adx; > y += sy; > - buf[x++] = ff_vorbis_floor1_inverse_db_table[y]; > + buf[x++] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)]; > } > - buf[x] = ff_vorbis_floor1_inverse_db_table[y]; > + buf[x] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)]; > } > if (x <= 0) { > if (err + ady >= 0) > y += sy; > - buf[x] = ff_vorbis_floor1_inverse_db_table[y]; > + buf[x] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)]; > } > } > > -static void render_line(int x0, uint8_t y0, int x1, int y1, float *buf) > +static void render_line(int x0, int y0, int x1, int y1, float *buf) > { > int dy = y1 - y0; > int adx = x1 - x0; > int ady = FFABS(dy); > int sy = dy < 0 ? -1 : 1; > - buf[x0] = ff_vorbis_floor1_inverse_db_table[y0]; > + buf[x0] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y0)]; > if (ady*2 <= adx) { // optimized common case > render_line_unrolled(x0, y0, x1, sy, ady, adx, buf); > } else { > int base = dy / adx; > int x = x0; > - uint8_t y = y0; > + int y = y0; > int err = -adx; > ady -= FFABS(base) * adx; > while (++x < x1) { > @@ -197,7 +197,7 @@ static void render_line(int x0, uint8_t y0, int x1, int > y1, float *buf) > err -= adx; > y += sy; > } > - buf[x] = ff_vorbis_floor1_inverse_db_table[y]; > + buf[x] = ff_vorbis_floor1_inverse_db_table[av_clip_uint8(y)]; > } > } > }
This is pointless. The value passed into these functions is a uint8_t. To get the effect you're looking for, you need to clip the value computed in ff_vorbis_floor1_render_list(). -- Måns Rullgård [email protected] _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
