X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Frl.h;h=9c1ad7a64298ff338f81eb911be26eccca7a63d8;hb=17ae608127324cabd083202a32a8dc210d30c3a1;hp=0335873648f13959d038e0846f92325da168e20a;hpb=f082badc2101c75d5a857da9001e5b5adaaa4762;p=ffmpeg diff --git a/libavcodec/rl.h b/libavcodec/rl.h index 0335873648f..9c1ad7a6429 100644 --- a/libavcodec/rl.h +++ b/libavcodec/rl.h @@ -1,5 +1,26 @@ +/* + * Copyright (c) 2000-2002 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + /** - * @file rl.h + * @file * rl header. */ @@ -7,8 +28,11 @@ #define AVCODEC_RL_H #include -#include "bitstream.h" -#include "mpegvideo.h" +#include "get_bits.h" + +/* run length table */ +#define MAX_RUN 64 +#define MAX_LEVEL 64 /** RLTable. */ typedef struct RLTable { @@ -30,7 +54,23 @@ typedef struct RLTable { * the level and run tables, if this is NULL av_malloc() will be used */ void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]); -void init_vlc_rl(RLTable *rl, int use_static); +void init_vlc_rl(RLTable *rl); + +#define INIT_VLC_RL(rl, static_size)\ +{\ + int q;\ + static RL_VLC_ELEM rl_vlc_table[32][static_size];\ + INIT_VLC_STATIC(&rl.vlc, 9, rl.n + 1,\ + &rl.table_vlc[0][1], 4, 2,\ + &rl.table_vlc[0][0], 4, 2, static_size);\ +\ + if(!rl.rl_vlc[0]){\ + for(q=0; q<32; q++)\ + rl.rl_vlc[q]= rl_vlc_table[q];\ +\ + init_vlc_rl(&rl);\ + }\ +} static inline int get_rl_index(const RLTable *rl, int last, int run, int level) { @@ -43,4 +83,4 @@ static inline int get_rl_index(const RLTable *rl, int last, int run, int level) return index + level - 1; } -#endif +#endif /* AVCODEC_RL_H */