[FFmpeg-cvslog] adx: simplify encoding by using put_sbits()
Justin Ruggles
git at videolan.org
Sun Nov 27 00:39:15 CET 2011
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Sun Nov 20 16:49:13 2011 -0500| [994238536a8ec8b970a16d153bee72c96ede0cc3] | committer: Justin Ruggles
adx: simplify encoding by using put_sbits()
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=994238536a8ec8b970a16d153bee72c96ede0cc3
---
libavcodec/adxenc.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c
index b85a70d..ae4b9f7 100644
--- a/libavcodec/adxenc.c
+++ b/libavcodec/adxenc.c
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "adx.h"
+#include "put_bits.h"
/**
* @file
@@ -37,6 +38,7 @@
static void adx_encode(ADXContext *c, unsigned char *adx, const short *wav,
ADXChannelState *prev)
{
+ PutBitContext pb;
int scale;
int i;
int s0,s1,s2,d;
@@ -72,9 +74,10 @@ static void adx_encode(ADXContext *c, unsigned char *adx, const short *wav,
AV_WB16(adx, scale);
- for(i=0;i<16;i++) {
- adx[i+2] = ((data[i*2]/scale)<<4) | ((data[i*2+1]/scale)&0xf);
- }
+ init_put_bits(&pb, adx + 2, 16);
+ for (i = 0; i < 32; i++)
+ put_sbits(&pb, 4, av_clip(data[i]/scale, -8, 7));
+ flush_put_bits(&pb);
}
static int adx_encode_header(AVCodecContext *avctx,unsigned char *buf,size_t bufsize)
More information about the ffmpeg-cvslog
mailing list