comparison mace.c @ 7809:74a7ac273231 libavcodec

Cosmetics: whitespace/linebreaks
author vitor
date Sun, 07 Sep 2008 09:55:47 +0000
parents 0acafe424d54
children 06d3f6968b90
comparison
equal deleted inserted replaced
7808:0acafe424d54 7809:74a7ac273231
244 ChannelData chd[2]; 244 ChannelData chd[2];
245 } MACEContext; 245 } MACEContext;
246 246
247 static void chomp3(ChannelData *ctx, int16_t *output, uint8_t val, 247 static void chomp3(ChannelData *ctx, int16_t *output, uint8_t val,
248 const uint16_t tab1[], 248 const uint16_t tab1[],
249 const uint16_t tab2[][8], uint32_t numChannels) 249 const uint16_t tab2[][8], uint32_t numChannels)
250 { 250 {
251 short current; 251 short current;
252 252
253 current = (short) tab2[(ctx->index & 0x7f0) >> 4][val]; 253 current = (short) tab2[(ctx->index & 0x7f0) >> 4][val];
254 254
266 ctx->index = 0; 266 ctx->index = 0;
267 } 267 }
268 268
269 static void chomp6(ChannelData *ctx, int16_t *output, uint8_t val, 269 static void chomp6(ChannelData *ctx, int16_t *output, uint8_t val,
270 const uint16_t tab1[], 270 const uint16_t tab1[],
271 const uint16_t tab2[][8], uint32_t numChannels) 271 const uint16_t tab2[][8], uint32_t numChannels)
272 { 272 {
273 short current; 273 short current;
274 274
275 current = (short)tab2[(ctx->index & 0x7f0) >> 4][val]; 275 current = (short)tab2[(ctx->index & 0x7f0) >> 4][val];
276 276
316 avctx->sample_fmt = SAMPLE_FMT_S16; 316 avctx->sample_fmt = SAMPLE_FMT_S16;
317 return 0; 317 return 0;
318 } 318 }
319 319
320 static int mace3_decode_frame(AVCodecContext *avctx, 320 static int mace3_decode_frame(AVCodecContext *avctx,
321 void *data, int *data_size, 321 void *data, int *data_size,
322 const uint8_t *buf, int buf_size) 322 const uint8_t *buf, int buf_size)
323 { 323 {
324 short *samples = data; 324 short *samples = data;
325 MACEContext *ctx = avctx->priv_data; 325 MACEContext *ctx = avctx->priv_data;
326 int i, j, k; 326 int i, j, k;
327 327
329 int16_t *output = samples + i; 329 int16_t *output = samples + i;
330 330
331 for (j=0; j < buf_size / 2 / avctx->channels; j++) 331 for (j=0; j < buf_size / 2 / avctx->channels; j++)
332 for (k=0; k < 2; k++) { 332 for (k=0; k < 2; k++) {
333 uint8_t pkt = buf[i*2 + j*2*avctx->channels + k]; 333 uint8_t pkt = buf[i*2 + j*2*avctx->channels + k];
334 chomp3(&ctx->chd[i], output, pkt &7, MACEtab1, MACEtab2, avctx->channels); 334 chomp3(&ctx->chd[i], output, pkt &7, MACEtab1, MACEtab2,
335 avctx->channels);
335 output += avctx->channels; 336 output += avctx->channels;
336 chomp3(&ctx->chd[i], output,(pkt >> 3) &3, MACEtab3, MACEtab4, avctx->channels); 337 chomp3(&ctx->chd[i], output,(pkt >> 3) &3, MACEtab3, MACEtab4,
338 avctx->channels);
337 output += avctx->channels; 339 output += avctx->channels;
338 chomp3(&ctx->chd[i], output, pkt >> 5 , MACEtab1, MACEtab2, avctx->channels); 340 chomp3(&ctx->chd[i], output, pkt >> 5 , MACEtab1, MACEtab2,
341 avctx->channels);
339 output += avctx->channels; 342 output += avctx->channels;
340 } 343 }
341 } 344 }
342 345
343 *data_size = 2 * 3 * buf_size; 346 *data_size = 2 * 3 * buf_size;
344 347
345 return buf_size; 348 return buf_size;
346 } 349 }
347 350
348 static int mace6_decode_frame(AVCodecContext *avctx, 351 static int mace6_decode_frame(AVCodecContext *avctx,
349 void *data, int *data_size, 352 void *data, int *data_size,
350 const uint8_t *buf, int buf_size) 353 const uint8_t *buf, int buf_size)
351 { 354 {
352 short *samples = data; 355 short *samples = data;
353 MACEContext *ctx = avctx->priv_data; 356 MACEContext *ctx = avctx->priv_data;
354 int i, j; 357 int i, j;
355 358
357 int16_t *output = samples + i; 360 int16_t *output = samples + i;
358 361
359 for (j = 0; j < buf_size / avctx->channels; j++) { 362 for (j = 0; j < buf_size / avctx->channels; j++) {
360 uint8_t pkt = buf[i + j*avctx->channels]; 363 uint8_t pkt = buf[i + j*avctx->channels];
361 364
362 chomp6(&ctx->chd[i], output, pkt >> 5 , MACEtab1, MACEtab2, avctx->channels); 365 chomp6(&ctx->chd[i], output, pkt >> 5 , MACEtab1, MACEtab2,
366 avctx->channels);
363 output += avctx->channels << 1; 367 output += avctx->channels << 1;
364 chomp6(&ctx->chd[i], output,(pkt >> 3) & 3, MACEtab3, MACEtab4, avctx->channels); 368 chomp6(&ctx->chd[i], output,(pkt >> 3) & 3, MACEtab3, MACEtab4,
369 avctx->channels);
365 output += avctx->channels << 1; 370 output += avctx->channels << 1;
366 chomp6(&ctx->chd[i], output, pkt & 7, MACEtab1, MACEtab2, avctx->channels); 371 chomp6(&ctx->chd[i], output, pkt & 7, MACEtab1, MACEtab2,
372 avctx->channels);
367 output += avctx->channels << 1; 373 output += avctx->channels << 1;
368 } 374 }
369 } 375 }
370 376
371 *data_size = 2 * 6 * buf_size; 377 *data_size = 2 * 6 * buf_size;