You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
mlpenc: fix huff offset calculation
huff offset wasn't always within the bounds before, which lead to corrupt encoding that didn't always trigger lossless check failures Signed-off-by: Jai Luthra <me@jailuthra.in>
This commit is contained in:
@@ -1699,7 +1699,7 @@ static inline void codebook_bits(MLPEncodeContext *ctx,
|
|||||||
offset_min = FFMAX(min, HUFF_OFFSET_MIN);
|
offset_min = FFMAX(min, HUFF_OFFSET_MIN);
|
||||||
offset_max = FFMIN(max, HUFF_OFFSET_MAX);
|
offset_max = FFMIN(max, HUFF_OFFSET_MAX);
|
||||||
|
|
||||||
for (;;) {
|
while (offset <= offset_max && offset >= offset_min) {
|
||||||
BestOffset temp_bo;
|
BestOffset temp_bo;
|
||||||
|
|
||||||
codebook_bits_offset(ctx, channel, codebook,
|
codebook_bits_offset(ctx, channel, codebook,
|
||||||
@@ -1718,12 +1718,8 @@ static inline void codebook_bits(MLPEncodeContext *ctx,
|
|||||||
|
|
||||||
if (direction) {
|
if (direction) {
|
||||||
offset = temp_bo.max + 1;
|
offset = temp_bo.max + 1;
|
||||||
if (offset > offset_max)
|
|
||||||
break;
|
|
||||||
} else {
|
} else {
|
||||||
offset = temp_bo.min - 1;
|
offset = temp_bo.min - 1;
|
||||||
if (offset < offset_min)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user