| @@ -259,7 +259,7 @@ static int pcm_decode_frame(AVCodecContext *avctx, · 258 unmodified lines |
| 259 | 259 | const uint8_t *buf = avpkt->data; |
| 260 | 260 | int buf_size = avpkt->size; |
| 261 | 261 | PCMDecode *s = avctx->priv_data; |
| 262 | | − int sample_size, c, n; |
| 262 | + int sample_size, c, n, i; |
| 263 | 263 | short *samples; |
| 264 | 264 | const uint8_t *src, *src8, *src2[MAX_CHANNELS]; |
| 265 | 265 | uint8_t *dstu8; |
| @@ -288,6 +288,9 @@ static int pcm_decode_frame(AVCodecContext *avctx, · 22 unmodified lines |
| 288 | 288 | if (CODEC_ID_PCM_DVD == avctx->codec_id) |
| 289 | 289 | /* 2 samples are interleaved per block in PCM_DVD */ |
| 290 | 290 | sample_size = avctx->bits_per_coded_sample * 2 / 8; |
| 291 | + else if (avctx->codec_id == CODEC_ID_PCM_LXF) |
| 292 | + /* we process 40-bit blocks per channel for LXF */ |
| 293 | + sample_size = 5; |
| 291 | 294 | |
| 292 | 295 | n = avctx->channels * sample_size; |
| 293 | 296 | |
| @@ -436,6 +439,26 @@ static int pcm_decode_frame(AVCodecContext *avctx, · 142 unmodified lines |
| 436 | 439 | } |
| 437 | 440 | samples = (short *) dst_int32_t; |
| 438 | 441 | break; |
| 442 | + case CODEC_ID_PCM_LXF: |
| 443 | + dst_int32_t = data; |
| 444 | + n /= avctx->channels; |
| 445 | + //unpack and de-planerize |
| 446 | + for (i = 0; i < n; i++) { |
| 447 | + for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) { |
| 448 | + //extract low 20 bits and expand to 32 bits |
| 449 | + *dst_int32_t++ = (src8[2] << 28) | (src8[1] << 20) | (src8[0] << 12) | |
| 450 | + ((src8[2] & 0xF) << 8) | src8[1]; |
| 451 | + } |
| 452 | + |
| 453 | + for (c = 0, src8 = src + i*5; c < avctx->channels; c++, src8 += n*5) { |
| 454 | + //extract high 20 bits and expand to 32 bits |
| 455 | + *dst_int32_t++ = (src8[4] << 24) | (src8[3] << 16) | |
| 456 | + ((src8[2] & 0xF0) << 8) | (src8[4] << 4) | (src8[3] >> 4); |
| 457 | + } |
| 458 | + } |
| 459 | + src += n * avctx->channels * 5; |
| 460 | + samples = (short *) dst_int32_t; |
| 461 | + break; |
| 439 | 462 | default: |
| 440 | 463 | return -1; |
| 441 | 464 | } |
| @@ -485,6 +508,7 @@ PCM_CODEC (CODEC_ID_PCM_F32BE, SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating · 43 unmodified lines |
| 485 | 508 | PCM_CODEC (CODEC_ID_PCM_F32LE, SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian"); |
| 486 | 509 | PCM_CODEC (CODEC_ID_PCM_F64BE, SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian"); |
| 487 | 510 | PCM_CODEC (CODEC_ID_PCM_F64LE, SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian"); |
| 511 | +PCM_DECODER(CODEC_ID_PCM_LXF, SAMPLE_FMT_S32, pcm_lxf, "PCM signed 20-bit little-endian planar"); |
| 488 | 512 | PCM_CODEC (CODEC_ID_PCM_MULAW, SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law"); |
| 489 | 513 | PCM_CODEC (CODEC_ID_PCM_S8, SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit"); |
| 490 | 514 | PCM_CODEC (CODEC_ID_PCM_S16BE, SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian"); |