comparison ra288.c @ 7174:7c4589349c01 libavcodec

Remove useless wrapper around ra288_decode_frame()
author vitor
date Mon, 30 Jun 2008 19:30:27 +0000
parents bc2fd265f52b
children 1fcdc0b3d7f9
comparison
equal deleted inserted replaced
7173:bc2fd265f52b 7174:7c4589349c01
203 203
204 if (pred(temp2, glob->st2, 10)) 204 if (pred(temp2, glob->st2, 10))
205 colmult(glob->pr2, glob->st2, table2a, 10); 205 colmult(glob->pr2, glob->st2, table2a, 10);
206 } 206 }
207 207
208 static void * decode_block(AVCodecContext * avctx, const unsigned char *in, 208 /* Decode a block (celp) */
209 signed short int *out, unsigned len) 209 static int ra288_decode_frame(AVCodecContext * avctx, void *data,
210 { 210 int *data_size, const uint8_t * buf,
211 int buf_size)
212 {
213 int16_t *out = data;
211 int x, y; 214 int x, y;
212 Real288_internal *glob = avctx->priv_data; 215 Real288_internal *glob = avctx->priv_data;
213 GetBitContext gb; 216 GetBitContext gb;
214 217
215 init_get_bits(&gb, in, len * 8); 218 if (buf_size < avctx->block_align) {
219 av_log(avctx, AV_LOG_ERROR,
220 "Error! Input buffer is too small [%d<%d]\n",
221 buf_size, avctx->block_align);
222 return 0;
223 }
224
225 init_get_bits(&gb, buf, avctx->block_align * 8);
216 226
217 for (x=0; x < 32; x++) { 227 for (x=0; x < 32; x++) {
218 int amp_coef = get_bits(&gb, 3); 228 int amp_coef = get_bits(&gb, 3);
219 int cb_coef = get_bits(&gb, 6 + (x&1)); 229 int cb_coef = get_bits(&gb, 6 + (x&1));
220 glob->phasep = (glob->phase = x & 7) * 5; 230 glob->phasep = (glob->phase = x & 7) * 5;
224 234
225 if (glob->phase == 3) 235 if (glob->phase == 3)
226 update(glob); 236 update(glob);
227 } 237 }
228 238
229 return out; 239 *data_size = (char *)out - (char *)data;
230 }
231
232 /* Decode a block (celp) */
233 static int ra288_decode_frame(AVCodecContext * avctx, void *data,
234 int *data_size, const uint8_t * buf,
235 int buf_size)
236 {
237 void *datao;
238
239 if (buf_size < avctx->block_align) {
240 av_log(avctx, AV_LOG_ERROR,
241 "Error! Input buffer is too small [%d<%d]\n",
242 buf_size, avctx->block_align);
243 return 0;
244 }
245
246 datao = data;
247 data = decode_block(avctx, buf, (signed short *)data, avctx->block_align);
248
249 *data_size = (char *)data - (char *)datao;
250 return avctx->block_align; 240 return avctx->block_align;
251 } 241 }
252 242
253 AVCodec ra_288_decoder = 243 AVCodec ra_288_decoder =
254 { 244 {