aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-18 20:56:40 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-11-19 11:46:43 +0100
commit87c416d93a099587679549fe82c33be83cdbf192 (patch)
tree1eeb5671b9aab5dde4489ab4ebcf94320ddf0891
parent607e5038a9a521e6f64855c6eb408c433611b611 (diff)
downloadffmpeg-87c416d93a099587679549fe82c33be83cdbf192.tar.gz
avcodec/pcm-dvd: fix 20/24bit 1 channel
Fixes part of ticket3122 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit ab184b298d4a54199986de10927258aed18c7b6b)
-rw-r--r--libavcodec/pcm-dvd.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c
index b895e39786..243b6aa0bb 100644
--- a/libavcodec/pcm-dvd.c
+++ b/libavcodec/pcm-dvd.c
@@ -173,6 +173,17 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src,
#endif
return dst16;
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 {
for (i = s->groups_per_block; i; i--) {
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;
}
} while (--blocks);
+ }
return dst32;
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 {
for (i = s->groups_per_block; i; i--) {
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;
}
} while (--blocks);
+ }
return dst32;
default:
return NULL;