• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavcodec/rl.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2000-2002 Fabrice Bellard
00003  * Copyright (c) 2002-2004 Michael Niedermayer
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00027 #ifndef AVCODEC_RL_H
00028 #define AVCODEC_RL_H
00029 
00030 #include <stdint.h>
00031 #include "get_bits.h"
00032 
00033 /* run length table */
00034 #define MAX_RUN    64
00035 #define MAX_LEVEL  64
00036 
00038 typedef struct RLTable {
00039     int n;                         
00040     int last;                      
00041     const uint16_t (*table_vlc)[2];
00042     const int8_t *table_run;
00043     const int8_t *table_level;
00044     uint8_t *index_run[2];         
00045     int8_t *max_level[2];          
00046     int8_t *max_run[2];            
00047     VLC vlc;                       
00048     RL_VLC_ELEM *rl_vlc[32];       
00049 } RLTable;
00050 
00056 void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]);
00057 void init_vlc_rl(RLTable *rl);
00058 
00059 #define INIT_VLC_RL(rl, static_size)\
00060 {\
00061     int q;\
00062     static RL_VLC_ELEM rl_vlc_table[32][static_size];\
00063     INIT_VLC_STATIC(&rl.vlc, 9, rl.n + 1,\
00064              &rl.table_vlc[0][1], 4, 2,\
00065              &rl.table_vlc[0][0], 4, 2, static_size);\
00066 \
00067     if(!rl.rl_vlc[0]){\
00068         for(q=0; q<32; q++)\
00069             rl.rl_vlc[q]= rl_vlc_table[q];\
00070 \
00071         init_vlc_rl(&rl);\
00072     }\
00073 }
00074 
00075 static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
00076 {
00077     int index;
00078     index = rl->index_run[last][run];
00079     if (index >= rl->n)
00080         return rl->n;
00081     if (level > rl->max_level[last][run])
00082         return rl->n;
00083     return index + level - 1;
00084 }
00085 
00086 #endif /* AVCODEC_RL_H */

Generated on Fri Sep 16 2011 17:17:42 for FFmpeg by  doxygen 1.7.1