Måns Rullgård <[email protected]> writes:
> "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(-)
>>
[...]
> 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().
To be clear, this patch should be enough:
diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c
index 0b26870..7d6a4f0 100644
--- a/libavcodec/vorbis.c
+++ b/libavcodec/vorbis.c
@@ -207,9 +207,9 @@ void ff_vorbis_floor1_render_list(vorbis_floor1_entry *
list, int values,
int multiplier, float *out, int samples)
{
int lx, i;
- uint8_t ly;
+ int ly;
lx = 0;
- ly = y_list[0] * multiplier;
+ ly = av_clip_uint8(y_list[0] * multiplier);
for (i = 1; i < values; i++) {
int pos = list[i].sort;
if (flag[pos]) {
--
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel