Revision 9dc92a38

View differences:

Changelog
110 110
- TechnoTrend PVA demuxer
111 111
- Linux Media Labs MPEG-4 (LMLM4) demuxer
112 112
- AVM2 (Flash 9) SWF muxer
113
- QT variant of IMA ADPCM encoder
113 114

  
114 115
version 0.4.9-pre1:
115 116

  
Makefile
314 314
        ac3                                     \
315 315
        g726                                    \
316 316
        adpcm_ima_wav                           \
317
        adpcm_ima_qt                            \
317 318
        adpcm_ms                                \
318 319
        adpcm_yam                               \
319 320
        adpcm_swf                               \
doc/general.texi
261 261
@item AMV IMA ADPCM          @tab      @tab X
262 262
@tab Used in AMV files
263 263
@item MS IMA ADPCM           @tab X    @tab X
264
@item QT IMA ADPCM           @tab      @tab X
264
@item QT IMA ADPCM           @tab X    @tab X
265 265
@item 4X IMA ADPCM           @tab      @tab X
266 266
@item G.726  ADPCM           @tab X    @tab X
267 267
@item Duck DK3 IMA ADPCM     @tab      @tab X
libavcodec/adpcm.c
165 165
        avctx->block_align = BLKSIZE;
166 166
        /* seems frame_size isn't taken into account... have to buffer the samples :-( */
167 167
        break;
168
    case CODEC_ID_ADPCM_IMA_QT:
169
        avctx->frame_size = 64;
170
        avctx->block_align = 34 * avctx->channels;
171
        break;
168 172
    case CODEC_ID_ADPCM_MS:
169 173
        avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; /* each 16 bits sample gives one nibble */
170 174
                                                             /* and we have 7 bytes per channel overhead */
......
295 299
    nodes[0]->step = c->step_index;
296 300
    nodes[0]->sample1 = c->sample1;
297 301
    nodes[0]->sample2 = c->sample2;
298
    if((version == CODEC_ID_ADPCM_IMA_WAV) || (version == CODEC_ID_ADPCM_SWF))
302
    if((version == CODEC_ID_ADPCM_IMA_WAV) || (version == CODEC_ID_ADPCM_IMA_QT) || (version == CODEC_ID_ADPCM_SWF))
299 303
        nodes[0]->sample1 = c->prev_sample;
300 304
    if(version == CODEC_ID_ADPCM_MS)
301 305
        nodes[0]->step = c->idelta;
......
366 370
                    next_##NAME:;
367 371
                    STORE_NODE(ms, FFMAX(16, (AdaptationTable[nibble] * step) >> 8));
368 372
                }
369
            } else if((version == CODEC_ID_ADPCM_IMA_WAV)|| (version == CODEC_ID_ADPCM_SWF)) {
373
            } else if((version == CODEC_ID_ADPCM_IMA_WAV)|| (version == CODEC_ID_ADPCM_IMA_QT)|| (version == CODEC_ID_ADPCM_SWF)) {
370 374
#define LOOP_NODES(NAME, STEP_TABLE, STEP_INDEX)\
371 375
                const int predictor = nodes[j]->sample1;\
372 376
                const int div = (sample - predictor) * 4 / STEP_TABLE;\
......
509 513
                samples += 8 * avctx->channels;
510 514
            }
511 515
        break;
516
    case CODEC_ID_ADPCM_IMA_QT:
517
    {
518
        int ch, i;
519
        PutBitContext pb;
520
        init_put_bits(&pb, dst, buf_size*8);
521

  
522
        for(ch=0; ch<avctx->channels; ch++){
523
            put_bits(&pb, 9, (c->status[ch].prev_sample + 0x10000) >> 7);
524
            put_bits(&pb, 7, c->status[ch].step_index);
525
            if(avctx->trellis > 0) {
526
                uint8_t buf[64];
527
                adpcm_compress_trellis(avctx, samples+ch, buf, &c->status[ch], 64);
528
                for(i=0; i<64; i++)
529
                    put_bits(&pb, 4, buf[i^1]);
530
                c->status[ch].prev_sample = c->status[ch].predictor & ~0x7F;
531
            } else {
532
                for (i=0; i<64; i+=2){
533
                    int t1, t2;
534
                    t1 = adpcm_ima_compress_sample(&c->status[ch], samples[avctx->channels*(i+0)+ch]);
535
                    t2 = adpcm_ima_compress_sample(&c->status[ch], samples[avctx->channels*(i+1)+ch]);
536
                    put_bits(&pb, 4, t2);
537
                    put_bits(&pb, 4, t1);
538
                }
539
                c->status[ch].prev_sample &= ~0x7F;
540
            }
541
        }
542

  
543
        dst += put_bits_count(&pb)>>3;
544
        break;
545
    }
512 546
    case CODEC_ID_ADPCM_SWF:
513 547
    {
514 548
        int i;
......
1588 1622
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4);
1589 1623
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
1590 1624
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
1591
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
1625
ADPCM_CODEC  (CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
1592 1626
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
1593 1627
ADPCM_CODEC  (CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
1594 1628
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws);
libavcodec/allcodecs.c
249 249
    REGISTER_DECODER (ADPCM_IMA_DK4, adpcm_ima_dk4);
250 250
    REGISTER_DECODER (ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
251 251
    REGISTER_DECODER (ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
252
    REGISTER_DECODER (ADPCM_IMA_QT, adpcm_ima_qt);
252
    REGISTER_ENCDEC  (ADPCM_IMA_QT, adpcm_ima_qt);
253 253
    REGISTER_DECODER (ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
254 254
    REGISTER_ENCDEC  (ADPCM_IMA_WAV, adpcm_ima_wav);
255 255
    REGISTER_DECODER (ADPCM_IMA_WS, adpcm_ima_ws);
libavcodec/avcodec.h
31 31
#include <sys/types.h> /* size_t */
32 32

  
33 33
#define LIBAVCODEC_VERSION_MAJOR 51
34
#define LIBAVCODEC_VERSION_MINOR 50
35
#define LIBAVCODEC_VERSION_MICRO  1
34
#define LIBAVCODEC_VERSION_MINOR 51
35
#define LIBAVCODEC_VERSION_MICRO  0
36 36

  
37 37
#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
38 38
                                               LIBAVCODEC_VERSION_MINOR, \
tests/ffmpeg.regression.ref
179 179
266300 ./tests/data/a-adpcm_ima.wav
180 180
947196b1739a9d6fe0c29424cf61cd8c *./tests/data/adpcm_ima_wav.vsynth.out.wav
181 181
stddev:904.20 PSNR:37.19 bytes:1056768
182
efdae2746040dbc27be402b149556f1e *./tests/data/a-adpcm_qt.aiff
183
281184 ./tests/data/a-adpcm_qt.aiff
184
468fcd54a438f1b74060c2e9665be59e *./tests/data/adpcm_ima_qt.vsynth.out.wav
185
stddev:8931.22 PSNR:17.30 bytes:1056768
182 186
628d4789cf9ee16a756ac54b7fd8650d *./tests/data/a-adpcm_ms.wav
183 187
267320 ./tests/data/a-adpcm_ms.wav
184 188
91a84bb4f319a3a0bf0c0441b3d3a529 *./tests/data/adpcm_ms.vsynth.out.wav
tests/regression.sh
401 401
do_audio_decoding
402 402
fi
403 403

  
404
if [ -n "$do_adpcm_ima_qt" ] ; then
405
do_audio_encoding adpcm_qt.aiff "-ar 44100" "-acodec adpcm_ima_qt"
406
do_audio_decoding
407
fi
408

  
404 409
if [ -n "$do_adpcm_ms" ] ; then
405 410
do_audio_encoding adpcm_ms.wav "-ar 44100" "-acodec adpcm_ms"
406 411
do_audio_decoding
tests/rotozoom.regression.ref
179 179
266300 ./tests/data/a-adpcm_ima.wav
180 180
947196b1739a9d6fe0c29424cf61cd8c *./tests/data/adpcm_ima_wav.rotozoom.out.wav
181 181
stddev:904.20 PSNR:37.19 bytes:1056768
182
efdae2746040dbc27be402b149556f1e *./tests/data/a-adpcm_qt.aiff
183
281184 ./tests/data/a-adpcm_qt.aiff
184
468fcd54a438f1b74060c2e9665be59e *./tests/data/adpcm_ima_qt.rotozoom.out.wav
185
stddev:8931.22 PSNR:17.30 bytes:1056768
182 186
628d4789cf9ee16a756ac54b7fd8650d *./tests/data/a-adpcm_ms.wav
183 187
267320 ./tests/data/a-adpcm_ms.wav
184 188
91a84bb4f319a3a0bf0c0441b3d3a529 *./tests/data/adpcm_ms.rotozoom.out.wav
tests/seek.regression.ref
95 95
ret: 0 st:-1 ts:-0.645825 flags:1
96 96
ret: 0 st: 0 dts:-0.703991 pts:-0.703991 pos:41020 size:4096 flags:1
97 97
----------------
98
tests/data/a-adpcm_qt.aiff
99
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:72 size:4080 flags:1
100
ret: 0 st:-1 ts:-1.000000 flags:0
101
ret:-5
102
ret: 0 st:-1 ts:1.894167 flags:1
103
ret: 0 st: 0 dts:1.894059 pts:1.894059 pos:88812 size:4080 flags:1
104
ret: 0 st: 0 ts:0.788345 flags:0
105
ret: 0 st: 0 dts:0.789546 pts:0.789546 pos:37064 size:4080 flags:1
106
ret: 0 st: 0 ts:-0.317506 flags:1
107
ret: 0 st: 0 dts:-0.317846 pts:-0.317846 pos:69832 size:4080 flags:1
108
ret: 0 st:-1 ts:2.576668 flags:0
109
ret: 0 st: 0 dts:2.577642 pts:2.577642 pos:120840 size:4080 flags:1
110
ret: 0 st:-1 ts:1.470835 flags:1
111
ret: 0 st: 0 dts:1.470249 pts:1.470249 pos:68956 size:4080 flags:1
112
ret: 0 st: 0 ts:0.365011 flags:0
113
ret: 0 st: 0 dts:0.365737 pts:0.365737 pos:17208 size:4080 flags:1
114
ret: 0 st: 0 ts:-0.740839 flags:1
115
ret: 0 st: 0 dts:-0.741655 pts:-0.741655 pos:49976 size:4080 flags:1
116
ret: 0 st:-1 ts:2.153336 flags:0
117
ret: 0 st: 0 dts:2.153855 pts:2.153855 pos:100984 size:4080 flags:1
118
ret: 0 st:-1 ts:1.047503 flags:1
119
ret: 0 st: 0 dts:1.046440 pts:1.046440 pos:49100 size:4080 flags:1
120
ret: 0 st: 0 ts:-0.058322 flags:0
121
ret: 0 st: 0 dts:-0.058050 pts:-0.058050 pos:81868 size:4080 flags:1
122
ret: 0 st: 0 ts:2.835828 flags:1
123
ret: 0 st: 0 dts:2.834535 pts:2.834535 pos:132876 size:4080 flags:1
124
ret: 0 st:-1 ts:1.730004 flags:0
125
ret: 0 st: 0 dts:1.730045 pts:1.730045 pos:81128 size:4080 flags:1
126
ret: 0 st:-1 ts:0.624171 flags:1
127
ret: 0 st: 0 dts:0.624082 pts:0.624082 pos:29312 size:4080 flags:1
128
ret: 0 st: 0 ts:-0.481655 flags:0
129
ret: 0 st: 0 dts:-0.480408 pts:-0.480408 pos:62080 size:4080 flags:1
130
ret: 0 st: 0 ts:2.412494 flags:1
131
ret: 0 st: 0 dts:2.412200 pts:2.412200 pos:113088 size:4080 flags:1
132
ret: 0 st:-1 ts:1.306672 flags:0
133
ret: 0 st: 0 dts:1.307687 pts:1.307687 pos:61340 size:4080 flags:1
134
ret: 0 st:-1 ts:0.200839 flags:1
135
ret: 0 st: 0 dts:0.200295 pts:0.200295 pos:9456 size:4080 flags:1
136
ret: 0 st: 0 ts:-0.904989 flags:0
137
ret: 0 st: 0 dts:-0.904218 pts:-0.904218 pos:42224 size:4080 flags:1
138
ret: 0 st: 0 ts:1.989184 flags:1
139
ret: 0 st: 0 dts:1.988390 pts:1.988390 pos:93232 size:4080 flags:1
140
ret: 0 st:-1 ts:0.883340 flags:0
141
ret: 0 st: 0 dts:0.883900 pts:0.883900 pos:41484 size:4080 flags:1
142
ret: 0 st:-1 ts:-0.222493 flags:1
143
ret: 0 st: 0 dts:-0.223515 pts:-0.223515 pos:74252 size:4080 flags:1
144
ret: 0 st: 0 ts:2.671678 flags:0
145
ret: 0 st: 0 dts:2.671995 pts:2.671995 pos:125260 size:4080 flags:1
146
ret: 0 st: 0 ts:1.565850 flags:1
147
ret: 0 st: 0 dts:1.564580 pts:1.564580 pos:73376 size:4080 flags:1
148
ret: 0 st:-1 ts:0.460008 flags:0
149
ret: 0 st: 0 dts:0.460091 pts:0.460091 pos:21628 size:4080 flags:1
150
ret: 0 st:-1 ts:-0.645825 flags:1
151
ret: 0 st: 0 dts:-0.645873 pts:-0.645873 pos:54396 size:4080 flags:1
152
----------------
98 153
tests/data/a-adpcm_ms.wav
99 154
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:56 size:4096 flags:1
100 155
ret: 0 st:-1 ts:-1.000000 flags:0

Also available in: Unified diff