1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/pcm-dvd: fix 20/24bit 1 channel

Fixes part of ticket3122

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-11-18 20:56:40 +01:00
parent 5db49fc38d
commit ab184b298d

View File

@ -173,6 +173,17 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src,
#endif #endif
return dst16; return dst16;
case 20: case 20:
if (avctx->channels == 1) {
do {
for (i = 2; i; i--) {
dst32[0] = bytestream2_get_be16u(&gb) << 16;
dst32[1] = bytestream2_get_be16u(&gb) << 16;
t = bytestream2_get_byteu(&gb);
*dst32++ += (t & 0xf0) << 8;
*dst32++ += (t & 0x0f) << 12;
}
} while (--blocks);
} else {
do { do {
for (i = s->groups_per_block; i; i--) { for (i = s->groups_per_block; i; i--) {
dst32[0] = bytestream2_get_be16u(&gb) << 16; dst32[0] = bytestream2_get_be16u(&gb) << 16;
@ -187,8 +198,19 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src,
*dst32++ += (t & 0x0f) << 12; *dst32++ += (t & 0x0f) << 12;
} }
} while (--blocks); } while (--blocks);
}
return dst32; return dst32;
case 24: case 24:
if (avctx->channels == 1) {
do {
for (i = 2; i; i--) {
dst32[0] = bytestream2_get_be16u(&gb) << 16;
dst32[1] = bytestream2_get_be16u(&gb) << 16;
*dst32++ += bytestream2_get_byteu(&gb) << 8;
*dst32++ += bytestream2_get_byteu(&gb) << 8;
}
} while (--blocks);
} else {
do { do {
for (i = s->groups_per_block; i; i--) { for (i = s->groups_per_block; i; i--) {
dst32[0] = bytestream2_get_be16u(&gb) << 16; dst32[0] = bytestream2_get_be16u(&gb) << 16;
@ -201,6 +223,7 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src,
*dst32++ += bytestream2_get_byteu(&gb) << 8; *dst32++ += bytestream2_get_byteu(&gb) << 8;
} }
} while (--blocks); } while (--blocks);
}
return dst32; return dst32;
default: default:
return NULL; return NULL;