diff options
author | Daniel Verkamp <daniel@drv.nu> | 2009-10-22 20:43:55 +0000 |
---|---|---|
committer | Daniel Verkamp <daniel@drv.nu> | 2009-10-22 20:43:55 +0000 |
commit | b74d42ee330212dbfec8024e9490a5a7372497cc (patch) | |
tree | 9fcbc6e0e25a1bb48db0cdec0a832760694be566 | |
parent | df84d7d9bdf6b8e6896c711880f130b72738c828 (diff) | |
download | ffmpeg-b74d42ee330212dbfec8024e9490a5a7372497cc.tar.gz |
Build extradata in adpcm_ms encoder.
This fixes issue #1244.
Originally committed as revision 20349 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/adpcm.c | 12 | ||||
-rw-r--r-- | tests/rotozoom.regression.ref | 4 | ||||
-rw-r--r-- | tests/seek.regression.ref | 54 | ||||
-rw-r--r-- | tests/vsynth.regression.ref | 4 |
4 files changed, 43 insertions, 31 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index ebf37dbcf9..6abe18495c 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -154,6 +154,8 @@ typedef struct ADPCMContext { #if CONFIG_ENCODERS static av_cold int adpcm_encode_init(AVCodecContext *avctx) { + uint8_t *extradata; + int i; if (avctx->channels > 2) return -1; /* only stereo or mono =) */ @@ -177,6 +179,16 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx) avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; /* each 16 bits sample gives one nibble */ /* and we have 7 bytes per channel overhead */ avctx->block_align = BLKSIZE; + avctx->extradata_size = 32; + extradata = avctx->extradata = av_malloc(avctx->extradata_size); + if (!extradata) + return AVERROR(ENOMEM); + bytestream_put_le16(&extradata, avctx->frame_size); + bytestream_put_le16(&extradata, 7); /* wNumCoef */ + for (i = 0; i < 7; i++) { + bytestream_put_le16(&extradata, AdaptCoeff1[i] * 4); + bytestream_put_le16(&extradata, AdaptCoeff2[i] * 4); + } break; case CODEC_ID_ADPCM_YAMAHA: avctx->frame_size = BLKSIZE * avctx->channels; diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index a6dd7daff6..a089d91e7f 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -201,8 +201,8 @@ stddev: 903.51 PSNR: 37.20 bytes: 1061792/ 1058444 281252 ./tests/data/a-adpcm_qt.aiff 9580492803ba1c1a3746367b24b751c8 *./tests/data/adpcm_ima_qt.rotozoom.out.wav stddev: 914.63 PSNR: 37.09 bytes: 1058604/ 1058444 -9f813f0cc8b2c05821a31828eadf1188 *./tests/data/a-adpcm_ms.wav -268344 ./tests/data/a-adpcm_ms.wav +a407b87daeef5b25dfb6c5b3f519e9c1 *./tests/data/a-adpcm_ms.wav +268378 ./tests/data/a-adpcm_ms.wav 7be370f937c51e8a967e6a3d08d5156a *./tests/data/adpcm_ms.rotozoom.out.wav stddev: 1050.00 PSNR: 35.90 bytes: 1060620/ 1058444 2546d72df736b5ffa1557e8c9c9ef788 *./tests/data/a-adpcm_yam.wav diff --git a/tests/seek.regression.ref b/tests/seek.regression.ref index 57674f1c57..9601073ba0 100644 --- a/tests/seek.regression.ref +++ b/tests/seek.regression.ref @@ -151,59 +151,59 @@ ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 72 size: 4080 ---------------- tests/data/a-adpcm_ms.wav -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 56 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 90 size: 4096 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 56 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 90 size: 4096 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.856009 pts: 1.856009 pos: 29752 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.856009 pts: 1.856009 pos: 29786 size: 4096 ret: 0 st: 0 flags:0 ts: 0.788345 -ret: 0 st: 0 flags:1 dts: 0.831995 pts: 0.831995 pos: 13368 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.831995 pts: 0.831995 pos: 13402 size: 4096 ret: 0 st: 0 flags:1 ts:-0.317506 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 56 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 90 size: 4096 ret: 0 st:-1 flags:0 ts: 2.576668 -ret: 0 st: 0 flags:1 dts: 2.623991 pts: 2.623991 pos: 42040 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.623991 pts: 2.623991 pos: 42074 size: 4096 ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.408005 pts: 1.408005 pos: 22584 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.408005 pts: 1.408005 pos: 22618 size: 4096 ret: 0 st: 0 flags:0 ts: 0.365011 -ret: 0 st: 0 flags:1 dts: 0.383991 pts: 0.383991 pos: 6200 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.383991 pts: 0.383991 pos: 6234 size: 4096 ret: 0 st: 0 flags:1 ts:-0.740839 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 56 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 90 size: 4096 ret: 0 st:-1 flags:0 ts: 2.153336 -ret: 0 st: 0 flags:1 dts: 2.176009 pts: 2.176009 pos: 34872 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.176009 pts: 2.176009 pos: 34906 size: 4096 ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 1.023991 pts: 1.023991 pos: 16440 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.023991 pts: 1.023991 pos: 16474 size: 4096 ret: 0 st: 0 flags:0 ts:-0.058322 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 56 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 90 size: 4096 ret: 0 st: 0 flags:1 ts: 2.835828 -ret: 0 st: 0 flags:1 dts: 2.816009 pts: 2.816009 pos: 45112 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.816009 pts: 2.816009 pos: 45146 size: 4096 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.791995 pts: 1.791995 pos: 28728 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.791995 pts: 1.791995 pos: 28762 size: 4096 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.576009 pts: 0.576009 pos: 9272 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.576009 pts: 0.576009 pos: 9306 size: 4096 ret: 0 st: 0 flags:0 ts:-0.481655 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 56 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 90 size: 4096 ret: 0 st: 0 flags:1 ts: 2.412494 -ret: 0 st: 0 flags:1 dts: 2.368005 pts: 2.368005 pos: 37944 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.368005 pts: 2.368005 pos: 37978 size: 4096 ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.343991 pts: 1.343991 pos: 21560 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.343991 pts: 1.343991 pos: 21594 size: 4096 ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.191995 pts: 0.191995 pos: 3128 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.191995 pts: 0.191995 pos: 3162 size: 4096 ret: 0 st: 0 flags:0 ts:-0.904989 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 56 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 90 size: 4096 ret: 0 st: 0 flags:1 ts: 1.989184 -ret: 0 st: 0 flags:1 dts: 1.983991 pts: 1.983991 pos: 31800 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.983991 pts: 1.983991 pos: 31834 size: 4096 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.896009 pts: 0.896009 pos: 14392 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.896009 pts: 0.896009 pos: 14426 size: 4096 ret: 0 st:-1 flags:1 ts:-0.222493 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 56 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 90 size: 4096 ret: 0 st: 0 flags:0 ts: 2.671678 -ret: 0 st: 0 flags:1 dts: 2.688005 pts: 2.688005 pos: 43064 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.688005 pts: 2.688005 pos: 43098 size: 4096 ret: 0 st: 0 flags:1 ts: 1.565850 -ret: 0 st: 0 flags:1 dts: 1.536009 pts: 1.536009 pos: 24632 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.536009 pts: 1.536009 pos: 24666 size: 4096 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.511995 pts: 0.511995 pos: 8248 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.511995 pts: 0.511995 pos: 8282 size: 4096 ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 56 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 90 size: 4096 ---------------- tests/data/a-adpcm_swf.flv ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 208 size: 2053 diff --git a/tests/vsynth.regression.ref b/tests/vsynth.regression.ref index 971abb4eea..0b14ee3c4d 100644 --- a/tests/vsynth.regression.ref +++ b/tests/vsynth.regression.ref @@ -201,8 +201,8 @@ stddev: 903.51 PSNR: 37.20 bytes: 1061792/ 1058444 281252 ./tests/data/a-adpcm_qt.aiff 9580492803ba1c1a3746367b24b751c8 *./tests/data/adpcm_ima_qt.vsynth.out.wav stddev: 914.63 PSNR: 37.09 bytes: 1058604/ 1058444 -9f813f0cc8b2c05821a31828eadf1188 *./tests/data/a-adpcm_ms.wav -268344 ./tests/data/a-adpcm_ms.wav +a407b87daeef5b25dfb6c5b3f519e9c1 *./tests/data/a-adpcm_ms.wav +268378 ./tests/data/a-adpcm_ms.wav 7be370f937c51e8a967e6a3d08d5156a *./tests/data/adpcm_ms.vsynth.out.wav stddev: 1050.00 PSNR: 35.90 bytes: 1060620/ 1058444 2546d72df736b5ffa1557e8c9c9ef788 *./tests/data/a-adpcm_yam.wav |