[FFmpeg-cvslog] r8960 - trunk/libavcodec/pcm.c
ramiro
subversion
Thu May 10 01:08:01 CEST 2007
Author: ramiro
Date: Thu May 10 01:08:01 2007
New Revision: 8960
Log:
Factorize usum
Modified:
trunk/libavcodec/pcm.c
Modified: trunk/libavcodec/pcm.c
==============================================================================
--- trunk/libavcodec/pcm.c (original)
+++ trunk/libavcodec/pcm.c Thu May 10 01:08:01 2007
@@ -169,12 +169,13 @@ static int pcm_encode_close(AVCodecConte
*/
static inline void encode_from16(int bps, int le, int us,
short **samples, uint8_t **dst, int n) {
+ int usum = us ? 0x8000 : 0;
if (bps > 2)
memset(*dst, 0, n * bps);
if (le) *dst += bps - 2;
for(;n>0;n--) {
register int v = *(*samples)++;
- if (us) v += 0x8000;
+ v += usum;
(*dst)[le] = v >> 8;
(*dst)[1 - le] = v;
*dst += bps;
@@ -361,10 +362,11 @@ static int pcm_decode_init(AVCodecContex
static inline void decode_to16(int bps, int le, int us,
uint8_t **src, short **samples, int src_len)
{
+ int usum = us ? -0x8000 : 0;
register int n = src_len / bps;
if (le) *src += bps - 2;
for(;n>0;n--) {
- *(*samples)++ = ((*src)[le] << 8 | (*src)[1 - le]) - (us?0x8000:0);
+ *(*samples)++ = ((*src)[le] << 8 | (*src)[1 - le]) + usum;
*src += bps;
}
if (le) *src -= bps - 2;
More information about the ffmpeg-cvslog
mailing list