mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-30 12:06:40 +08:00
adpcmenc: Calculate the IMA_QT predictor without overflow
Previously, the value given to put_bits was 10 bits long for positive predictors, even though 9 bits were to be written. The extra bit could in some cases overwrite existing bits in the bitstream writer cache. This fixes a failed assert in put_bits.h, when running a version built with -DDEBUG. The fate test result gets slightly improved, thanks to getting rid of the overwritten bits in the bitstream writer cache. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
committed by
Martin Storsjö
parent
f82c4fb27f
commit
aa264da5bf
@@ -570,7 +570,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
||||
init_put_bits(&pb, dst, pkt_size * 8);
|
||||
|
||||
for (ch = 0; ch < avctx->channels; ch++) {
|
||||
put_bits(&pb, 9, (c->status[ch].prev_sample + 0x10000) >> 7);
|
||||
put_bits(&pb, 9, (c->status[ch].prev_sample & 0xFFFF) >> 7);
|
||||
put_bits(&pb, 7, c->status[ch].step_index);
|
||||
if (avctx->trellis > 0) {
|
||||
uint8_t buf[64];
|
||||
|
||||
Reference in New Issue
Block a user