aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg12enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-08 02:03:14 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-11-08 02:03:14 +0100
commit0bd42ae72c0e88826b823d8106286d5abe2028e7 (patch)
treeda7087d1f67ea54580026e30dcedb4f58db6aba6 /libavcodec/mpeg12enc.c
parent5955c63c36e9b822f1186cd45a8dec5056b9c575 (diff)
parent1c8c41ff079953d332f61a9d26656e4e36af606c (diff)
downloadffmpeg-0bd42ae72c0e88826b823d8106286d5abe2028e7.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: avformat: Avoid a warning about mixed declarations and code BMV demuxer and decoder matroskaenc: Make sure the seekhead struct is freed even on seek failure mpeg12enc: Remove write-only variables. mpeg12enc: Don't set up run-level info for level 0. msmpeg4: Don't set up run-level info for level 0. avformat: Warn about using network functions without calling avformat_network_init avformat: Revise wording rdt: Set AVFMT_NOFILE on ff_rdt_demuxer rdt: Check the return value of avformat_open rtsp: Discard the dynamic handler, if it has an alloc function which failed dsputil: use cpuflags in x86 versions of vector_clip_int32() Conflicts: libavcodec/avcodec.h libavcodec/version.h libavformat/Makefile libavformat/allformats.c libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg12enc.c')
-rw-r--r--libavcodec/mpeg12enc.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 21b957c8cc..653fb4015c 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -75,11 +75,12 @@ static void init_uni_ac_vlc(RLTable *rl, uint8_t *uni_ac_vlc_len){
for(i=0; i<128; i++){
int level= i-64;
int run;
+ if (!level)
+ continue;
for(run=0; run<64; run++){
- int len, bits, code;
+ int len, code;
int alevel= FFABS(level);
- int sign= (level>>31)&1;
if (alevel > rl->max_level[0][run])
code= 111; /*rl->n*/
@@ -87,25 +88,15 @@ static void init_uni_ac_vlc(RLTable *rl, uint8_t *uni_ac_vlc_len){
code= rl->index_run[0][run] + alevel - 1;
if (code < 111 /* rl->n */) {
- /* store the vlc & sign at once */
+ /* length of vlc and sign */
len= rl->table_vlc[code][1]+1;
- bits= (rl->table_vlc[code][0]<<1) + sign;
} else {
len= rl->table_vlc[111/*rl->n*/][1]+6;
- bits= rl->table_vlc[111/*rl->n*/][0]<<6;
- bits|= run;
if (alevel < 128) {
- bits<<=8; len+=8;
- bits|= level & 0xff;
+ len += 8;
} else {
- bits<<=16; len+=16;
- bits|= level & 0xff;
- if (level < 0) {
- bits|= 0x8001 + level + 255;
- } else {
- bits|= level & 0xffff;
- }
+ len += 16;
}
}