annotate adxdec.c @ 10074:c4a83f3a5c9f libavcodec

bring back some randomness in fft-test. (regression in r18070)
author lorenm
date Sat, 22 Aug 2009 15:56:06 +0000
parents 54bc8a2727b0
children 8a4984c5cacc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
1 /*
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
2 * ADX ADPCM codecs
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
3 * Copyright (c) 2001,2003 BERO
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3445
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3445
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3445
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3445
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3445
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
15 * Lesser General Public License for more details.
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
16 *
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3445
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2967
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
20 */
8573
2acf0ae7b041 Fix build: Add intreadwrite.h and bswap.h #includes where necessary.
diego
parents: 7600
diff changeset
21
2acf0ae7b041 Fix build: Add intreadwrite.h and bswap.h #includes where necessary.
diego
parents: 7600
diff changeset
22 #include "libavutil/intreadwrite.h"
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
23 #include "avcodec.h"
5866
b1b3dd3324ae split adx encoder in its own file
aurel
parents: 5865
diff changeset
24 #include "adx.h"
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
25
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
26 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8673
diff changeset
27 * @file libavcodec/adxdec.c
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
28 * SEGA CRI adx codecs.
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
29 *
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
30 * Reference documents:
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
31 * http://ku-www.ss.titech.ac.jp/~yatsushi/adx.html
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
32 * adx2wav & wav2adx http://www.geocities.co.jp/Playtown/2004/
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
33 */
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
34
7600
3e0103ac9d76 Mark adx_decode_init() as type int instead of void, the function returns
diego
parents: 7451
diff changeset
35 static av_cold int adx_decode_init(AVCodecContext *avctx)
7451
85ab7655ad4d Modify all codecs to report their supported input and output sample format(s).
pross
parents: 7040
diff changeset
36 {
85ab7655ad4d Modify all codecs to report their supported input and output sample format(s).
pross
parents: 7040
diff changeset
37 avctx->sample_fmt = SAMPLE_FMT_S16;
85ab7655ad4d Modify all codecs to report their supported input and output sample format(s).
pross
parents: 7040
diff changeset
38 return 0;
85ab7655ad4d Modify all codecs to report their supported input and output sample format(s).
pross
parents: 7040
diff changeset
39 }
85ab7655ad4d Modify all codecs to report their supported input and output sample format(s).
pross
parents: 7040
diff changeset
40
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
41 /* 18 bytes <-> 32 samples */
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
42
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
43 static void adx_decode(short *out,const unsigned char *in,PREV *prev)
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
44 {
5067
6166fbf375cc Remove duplicate bytestream functions
ramiro
parents: 3947
diff changeset
45 int scale = AV_RB16(in);
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
46 int i;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
47 int s0,s1,s2,d;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
48
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
49 // printf("%x ",scale);
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
50
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
51 in+=2;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
52 s1 = prev->s1;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
53 s2 = prev->s2;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
54 for(i=0;i<16;i++) {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
55 d = in[i];
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
56 // d>>=4; if (d&8) d-=16;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
57 d = ((signed char)d >> 4);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
58 s0 = (BASEVOL*d*scale + SCALE1*s1 - SCALE2*s2)>>14;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
59 s2 = s1;
5525
bc4791868c52 various simplifications around recent av_clip_int16() usage
aurel
parents: 5523
diff changeset
60 s1 = av_clip_int16(s0);
bc4791868c52 various simplifications around recent av_clip_int16() usage
aurel
parents: 5523
diff changeset
61 *out++=s1;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
62
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
63 d = in[i];
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
64 //d&=15; if (d&8) d-=16;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
65 d = ((signed char)(d<<4) >> 4);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
66 s0 = (BASEVOL*d*scale + SCALE1*s1 - SCALE2*s2)>>14;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
67 s2 = s1;
5525
bc4791868c52 various simplifications around recent av_clip_int16() usage
aurel
parents: 5523
diff changeset
68 s1 = av_clip_int16(s0);
bc4791868c52 various simplifications around recent av_clip_int16() usage
aurel
parents: 5523
diff changeset
69 *out++=s1;
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
70 }
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
71 prev->s1 = s1;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
72 prev->s2 = s2;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
73
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
74 }
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
75
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
76 static void adx_decode_stereo(short *out,const unsigned char *in,PREV *prev)
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
77 {
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
78 short tmp[32*2];
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
79 int i;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
80
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
81 adx_decode(tmp ,in ,prev);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
82 adx_decode(tmp+32,in+18,prev+1);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
83 for(i=0;i<32;i++) {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
84 out[i*2] = tmp[i];
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
85 out[i*2+1] = tmp[i+32];
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
86 }
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
87 }
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
88
5864
0fc269ea2919 cleanup and simplify adx_decode_header()
aurel
parents: 5863
diff changeset
89 /* return data offset or 0 */
0fc269ea2919 cleanup and simplify adx_decode_header()
aurel
parents: 5863
diff changeset
90 static int adx_decode_header(AVCodecContext *avctx,const unsigned char *buf,size_t bufsize)
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
91 {
5864
0fc269ea2919 cleanup and simplify adx_decode_header()
aurel
parents: 5863
diff changeset
92 int offset;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
93
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
94 if (buf[0]!=0x80) return 0;
5067
6166fbf375cc Remove duplicate bytestream functions
ramiro
parents: 3947
diff changeset
95 offset = (AV_RB32(buf)^0x80000000)+4;
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
96 if (bufsize<offset || memcmp(buf+offset-6,"(c)CRI",6)) return 0;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
97
5864
0fc269ea2919 cleanup and simplify adx_decode_header()
aurel
parents: 5863
diff changeset
98 avctx->channels = buf[7];
0fc269ea2919 cleanup and simplify adx_decode_header()
aurel
parents: 5863
diff changeset
99 avctx->sample_rate = AV_RB32(buf+8);
0fc269ea2919 cleanup and simplify adx_decode_header()
aurel
parents: 5863
diff changeset
100 avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
101
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
102 return offset;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
103 }
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
104
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
105 static int adx_decode_frame(AVCodecContext *avctx,
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
106 void *data, int *data_size,
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 9083
diff changeset
107 AVPacket *avpkt)
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
108 {
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 9083
diff changeset
109 const uint8_t *buf0 = avpkt->data;
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 9083
diff changeset
110 int buf_size = avpkt->size;
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
111 ADXContext *c = avctx->priv_data;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
112 short *samples = data;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
113 const uint8_t *buf = buf0;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
114 int rest = buf_size;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
115
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
116 if (!c->header_parsed) {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
117 int hdrsize = adx_decode_header(avctx,buf,rest);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
118 if (hdrsize==0) return -1;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
119 c->header_parsed = 1;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
120 buf += hdrsize;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
121 rest -= hdrsize;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
122 }
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
123
5704
cf77b8588f15 Do not try to decode more data than output buffer may hold
kostya
parents: 5525
diff changeset
124 /* 18 bytes of data are expanded into 32*2 bytes of audio,
cf77b8588f15 Do not try to decode more data than output buffer may hold
kostya
parents: 5525
diff changeset
125 so guard against buffer overflows */
cf77b8588f15 Do not try to decode more data than output buffer may hold
kostya
parents: 5525
diff changeset
126 if(rest/18 > *data_size/64)
cf77b8588f15 Do not try to decode more data than output buffer may hold
kostya
parents: 5525
diff changeset
127 rest = (*data_size/64) * 18;
cf77b8588f15 Do not try to decode more data than output buffer may hold
kostya
parents: 5525
diff changeset
128
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
129 if (c->in_temp) {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
130 int copysize = 18*avctx->channels - c->in_temp;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
131 memcpy(c->dec_temp+c->in_temp,buf,copysize);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
132 rest -= copysize;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
133 buf += copysize;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
134 if (avctx->channels==1) {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
135 adx_decode(samples,c->dec_temp,c->prev);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
136 samples += 32;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
137 } else {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
138 adx_decode_stereo(samples,c->dec_temp,c->prev);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
139 samples += 32*2;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
140 }
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
141 }
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
142 //
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
143 if (avctx->channels==1) {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
144 while(rest>=18) {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
145 adx_decode(samples,buf,c->prev);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
146 rest-=18;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
147 buf+=18;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
148 samples+=32;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
149 }
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
150 } else {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
151 while(rest>=18*2) {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
152 adx_decode_stereo(samples,buf,c->prev);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
153 rest-=18*2;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
154 buf+=18*2;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
155 samples+=32*2;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
156 }
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
157 }
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
158 //
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
159 c->in_temp = rest;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
160 if (rest) {
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
161 memcpy(c->dec_temp,buf,rest);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
162 buf+=rest;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
163 }
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
164 *data_size = (uint8_t*)samples - (uint8_t*)data;
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
165 // printf("%d:%d ",buf-buf0,*data_size); fflush(stdout);
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
166 return buf-buf0;
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
167 }
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
168
3445
2d042ed9dd2c make the adx adpcm codec available
mru
parents: 3356
diff changeset
169 AVCodec adpcm_adx_decoder = {
2d042ed9dd2c make the adx adpcm codec available
mru
parents: 3356
diff changeset
170 "adpcm_adx",
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
171 CODEC_TYPE_AUDIO,
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
172 CODEC_ID_ADPCM_ADX,
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
173 sizeof(ADXContext),
7451
85ab7655ad4d Modify all codecs to report their supported input and output sample format(s).
pross
parents: 7040
diff changeset
174 adx_decode_init,
1534
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
175 NULL,
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
176 NULL,
5bdf2017d854 replace file to remove nasty DOS CRs and hard tabs
melanson
parents: 1531
diff changeset
177 adx_decode_frame,
9083
bf274494b66e Change a bunch of codec long_names to be more consistent and descriptive.
diego
parents: 8718
diff changeset
178 .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
1531
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
179 };
a78de892cefd added CRI ADX and XA ADPCM audio modules, courtesy of BERO
melanson
parents:
diff changeset
180