Commit Graph

29 Commits

Author SHA1 Message Date
Martin Storsjö 0776e0ef6b adpcm: Write the proper predictor in trellis mode in IMA QT
The actual predictor value, set by the trellis code, never
was written back into the variable that was written into
the block header. This was accidentally removed in b304244b.

This significantly improves the audio quality of the trellis
case, which was plain broken since b304244b.

Encoding IMA QT with trellis still actually gives a slightly
worse quality than without trellis, since the trellis encoder
doesn't use the exact same way of rounding as in
adpcm_ima_qt_compress_sample and adpcm_ima_qt_expand_nibble.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-06-10 16:28:47 +03:00
Martin Storsjö 3d79d0c93e adpcm: Avoid reading out of bounds in the IMA QT trellis encoder
This was broken in 095be4fb - samples+ch (for the previous
non-planar case) equals &samples_p[ch][0]. The confusion
probably stemmed from the IMA WAV case where it originally
was &samples[avctx->channels + ch], which was correctly
changed into &samples_p[ch][1].

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-06-06 19:23:54 +03:00
Diego Biurrun b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Diego Biurrun ac9362c5d9 Move misplaced file author information where it belongs 2013-04-11 02:42:11 +02:00
Anton Khirnov f073b1500e lavc: remove disabled FF_API_OLD_ENCODE_AUDIO cruft 2013-03-09 08:36:40 +01:00
Justin Ruggles 5364327186 adpcmenc: ensure calls to adpcm_ima_compress_sample() are in the right order
Should fix fate-acodec-adpcm-ima_wav with several compilers.
2012-10-07 16:45:50 -04:00
Justin Ruggles 095be4fbf6 adpcmenc: use planar sample format for adpcm_ima_wav and adpcm_ima_qt 2012-10-06 12:25:33 -04:00
Justin Ruggles d9a13c2f56 adpcmenc: move 'ch' variable to higher scope
It is used for multiple codecs.
2012-10-06 12:25:33 -04:00
Justin Ruggles 9606f19b4e adpcmenc: fix 3 instances of variable shadowing 2012-10-06 12:25:33 -04:00
Justin Ruggles 1e35574bad adpcm_ima_wav: simplify encoding 2012-10-06 12:25:33 -04:00
Michael Niedermayer aa264da5bf 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>
2012-09-04 15:30:58 +03:00
Justin Ruggles 5d4ef004bf adpcm_swf: Use correct sample offsets when using trellis.
Fixes invalid reads when encoding mono streams when trellis is used.
2012-08-22 12:43:51 -04:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Ronald S. Bultje 98041afb5f adpcm: don't duplicate identical AVSampleFmt array for each encoder. 2012-07-21 16:31:15 -07:00
Martin Storsjö 00c3b67b8a cosmetics: Align codec declarations
Also break some long lines, remove codec function placeholder comments
and add spaces in sample/pixel format lists.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 22:37:38 +03:00
Justin Ruggles 24e74f0a0f adpcmenc: update to AVCodec.encode2() 2012-03-20 18:46:57 -04:00
Justin Ruggles 770a5c6d02 adpcmenc: Use correct frame_size for Yamaha ADPCM.
Output packet size should match avctx->block_align. The target output packet
size is 1024 bytes.
Before:
mono   - 1024 samples -> 512 bytes
stereo - 2048 samples -> 2048 bytes
After:
mono   - 2048 samples -> 1024 bytes
stereo - 1024 samples -> 1024 bytes
2012-02-20 15:52:32 -05:00
Justin Ruggles a3a0691bde adpcmenc: remove some unneeded casts 2012-01-30 19:12:55 -05:00
Justin Ruggles 149f2058a4 adpcmenc: use int16_t and uint8_t instead of short and unsigned char. 2012-01-30 19:12:55 -05:00
Justin Ruggles dd88ae831a adpcmenc: fix adpcm_ms extradata allocation
Add FF_INPUT_BUFFER_PADDING_SIZE.
If allocation fails, also free memory which was allocated previously in
adpcm_encode_init().
2012-01-30 19:12:55 -05:00
Justin Ruggles 877a1d409c adpcmenc: return proper AVERROR codes instead of -1 2012-01-30 19:12:55 -05:00
Justin Ruggles cb023d9afe adpcmenc: check for coded_frame allocation failure 2012-01-30 19:12:55 -05:00
Justin Ruggles ddf70db6d7 adpcmenc: Do not set coded_frame->key_frame.
It is already set in avcodec_alloc_frame().
2012-01-30 19:12:54 -05:00
Chris Berov dc6d043050 adpcmenc: cosmetics: pretty-printing
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2011-12-04 17:07:48 -05:00
Justin Ruggles 7c287b18a0 adpcm: update reference links
Add Multimedia Wiki link.
Mark dead links with [dead]. Some can still be accessed through archive.org.
Update URLs for pages which have moved.
Replace duplicated links in adpcmenc.c with a note to see the ADPCM decoder
reference documents.
2011-09-29 16:54:00 -04:00
Diego Biurrun 8671488799 Use explicit struct initializers for AVCodec declarations. 2011-09-24 12:11:19 +02:00
Justin Ruggles 9ff6d0791b adpcmenc: Set bits_per_coded_sample 2011-09-23 20:54:29 -04:00
Baptiste Coudurier b304244b54 adpcmenc: fix QT IMA ADPCM encoder
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-23 20:54:29 -04:00
Justin Ruggles 826c56d16e adpcm: split ADPCM encoders and decoders into separate files.
Move shared tables to a separate file as well.
2011-09-12 11:26:11 -04:00