[FFmpeg-devel] [PATCH] s302m: fix resampling for 16 and 24bits.
Clément Bœsch
ubitux at gmail.com
Sat Jun 4 15:07:00 CEST 2011
Hi,
Here are two fixes for the SMPTE 302M codec.
24 bits resampling:
input:
offset: 00 11 22 33 44 55 66
nibbles: AB CD EF #G HI JK L# ('#'=unused)
wanted output (2*32bits):
nibbles: 76 54 32 10
output1: FE DC BA 00
output2: LK JI HG 00
#G (offset 3) is truncated and reversed so it becomes G0 and so it
only needs a <<4 shift to set nibble 2 (it will be mixed with nibble
3 if <<8).
16 bits resampling:
input:
offset: 00 11 22 33 44
nibbles: AB CD #E FG H#
wanted output (2*16bits):
nibbles: 32 10
output1: DC BA
output2: HG FE
Here, the issue is similar, we get: HGF0|E0 instead of HGF0|(E0>>4).
16-bits fix is taken from FFmbc, and the second has been discussed on
IRC with Baptiste.
The patch needs confirmation testing from Baptiste, but sent here not to
forget (and those details may be worth).
Regards,
--
Clément B.
-------------- next part --------------
From f2772bf85b8553c6faaeaab748c58c6f68ffd028 Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <baptiste.coudurier at gmail.com>
Date: Sat, 4 Jun 2011 14:36:30 +0200
Subject: [PATCH] s302m: fix resampling for 16 and 24bits.
---
libavcodec/s302m.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
index e49827b..7673d16 100644
--- a/libavcodec/s302m.c
+++ b/libavcodec/s302m.c
@@ -107,7 +107,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
*o++ = (av_reverse[buf[6] & 0xf0] << 28) |
(av_reverse[buf[5]] << 20) |
(av_reverse[buf[4]] << 12) |
- (av_reverse[buf[3] & 0x0f] << 8);
+ (av_reverse[buf[3] & 0x0f] << 4);
buf += 7;
}
*data_size = (uint8_t*) o - (uint8_t*) data;
@@ -130,7 +130,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data,
av_reverse[buf[0]];
*o++ = (av_reverse[buf[4] & 0xf0] << 12) |
(av_reverse[buf[3]] << 4) |
- av_reverse[buf[2] & 0x0f];
+ av_reverse[buf[2]] >> 4;
buf += 5;
}
*data_size = (uint8_t*) o - (uint8_t*) data;
--
1.7.5.2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110604/6892c8cb/attachment.asc>
More information about the ffmpeg-devel
mailing list