ffmpeg/libavcodec/rl.h
Michael Niedermayer be2dd2559f Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: (23 commits)
  snow: Check mallocs at init
  vorbis: Validate that the floor 1 X values contain no duplicates.
  vorbisenc: check all allocations for failure
  indeo3: validate new frame size before resetting decoder
  lavfi: avfilter_merge_formats: handle case where inputs are same
  rv34: error out on size changes with frame threading
  rv34: Handle only complete frames in frame-mt.
  rv34: use AVERROR return values in ff_rv34_decode_frame()
  vlc/rl: Add ff_ prefix to the nonstatic symbols
  h263: Add ff_ prefix to nonstatic symbols
  alsdec: check opt_order.
  golomb: check remaining bits during unary decoding in get_ur_golomb_jpegls()
  lavf: don't segfault when a NULL filename is passed to avformat_open_input()
  mpegvideo: Don't use ff_mspel_motion() for vc1
  imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt
  eval: fix swapping of lt() and lte()
  nuv: check RTjpeg header for validity
  Revert "nuv: check per-frame header for validity."
  bmpdec: only initialize palette for pal8.
  sipr: fall back to setting mode based on bit_rate.
  ...

Conflicts:
	avconv.c
	libavcodec/dnxhddec.c
	libavcodec/golomb.h
	libavcodec/h263.h
	libavcodec/imgconvert.c
	libavcodec/mpegvideo_common.h
	libavcodec/mpegvideo_enc.c
	libavcodec/nuv.c
	libavcodec/rv34.c
	libavcodec/sipr.c
	libavcodec/vorbisdec.c
	libavcodec/vorbisenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-16 04:25:51 +02:00

87 lines
2.6 KiB
C

/*
* Copyright (c) 2000-2002 Fabrice Bellard
* Copyright (c) 2002-2004 Michael Niedermayer
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* rl header.
*/
#ifndef AVCODEC_RL_H
#define AVCODEC_RL_H
#include <stdint.h>
#include "get_bits.h"
/* run length table */
#define MAX_RUN 64
#define MAX_LEVEL 64
/** RLTable. */
typedef struct RLTable {
int n; ///< number of entries of table_vlc minus 1
int last; ///< number of values for last = 0
const uint16_t (*table_vlc)[2];
const int8_t *table_run;
const int8_t *table_level;
uint8_t *index_run[2]; ///< encoding only
int8_t *max_level[2]; ///< encoding & decoding
int8_t *max_run[2]; ///< encoding & decoding
VLC vlc; ///< decoding only deprecated FIXME remove
RL_VLC_ELEM *rl_vlc[32]; ///< decoding only
} RLTable;
/**
*
* @param static_store static uint8_t array[2][2*MAX_RUN + MAX_LEVEL + 3] which will hold
* the level and run tables, if this is NULL av_malloc() will be used
*/
void ff_init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]);
void ff_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];\
\
ff_init_vlc_rl(&rl);\
}\
}
static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
{
int index;
index = rl->index_run[last][run];
if (index >= rl->n)
return rl->n;
if (level > rl->max_level[last][run])
return rl->n;
return index + level - 1;
}
#endif /* AVCODEC_RL_H */