1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Mark some read-only datastructures as const.

patch by Stefan Huehner, stefan & at & huehner & dot & org

Originally committed as revision 5639 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Stefan Huehner 2006-07-06 13:53:07 +00:00 committed by Diego Biurrun
parent 0540cad324
commit 62a05b5b00
3 changed files with 14 additions and 14 deletions

View File

@ -41,7 +41,7 @@ typedef struct DPCMContext {
int channels; int channels;
short roq_square_array[256]; short roq_square_array[256];
long sample[2];//for SOL_DPCM long sample[2];//for SOL_DPCM
int *sol_table;//for SOL_DPCM const int *sol_table;//for SOL_DPCM
} DPCMContext; } DPCMContext;
#define SATURATE_S16(x) if (x < -32768) x = -32768; \ #define SATURATE_S16(x) if (x < -32768) x = -32768; \
@ -84,15 +84,15 @@ static int interplay_delta_table[] = {
}; };
static int sol_table_old[16] = static const int sol_table_old[16] =
{ 0x0, 0x1, 0x2 , 0x3, 0x6, 0xA, 0xF, 0x15, { 0x0, 0x1, 0x2 , 0x3, 0x6, 0xA, 0xF, 0x15,
-0x15, -0xF, -0xA, -0x6, -0x3, -0x2, -0x1, 0x0}; -0x15, -0xF, -0xA, -0x6, -0x3, -0x2, -0x1, 0x0};
static int sol_table_new[16] = static const int sol_table_new[16] =
{ 0x0, 0x1, 0x2, 0x3, 0x6, 0xA, 0xF, 0x15, { 0x0, 0x1, 0x2, 0x3, 0x6, 0xA, 0xF, 0x15,
0x0, -0x1, -0x2, -0x3, -0x6, -0xA, -0xF, -0x15}; 0x0, -0x1, -0x2, -0x3, -0x6, -0xA, -0xF, -0x15};
static int sol_table_16[128] = { static const int sol_table_16[128] = {
0x000, 0x008, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, 0x080, 0x000, 0x008, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, 0x080,
0x090, 0x0A0, 0x0B0, 0x0C0, 0x0D0, 0x0E0, 0x0F0, 0x100, 0x110, 0x120, 0x090, 0x0A0, 0x0B0, 0x0C0, 0x0D0, 0x0E0, 0x0F0, 0x100, 0x110, 0x120,
0x130, 0x140, 0x150, 0x160, 0x170, 0x180, 0x190, 0x1A0, 0x1B0, 0x1C0, 0x130, 0x140, 0x150, 0x160, 0x170, 0x180, 0x190, 0x1A0, 0x1B0, 0x1C0,

View File

@ -63,7 +63,7 @@ typedef struct PixFmtInfo {
} PixFmtInfo; } PixFmtInfo;
/* this table gives more information about formats */ /* this table gives more information about formats */
static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
/* YUV formats */ /* YUV formats */
[PIX_FMT_YUV420P] = { [PIX_FMT_YUV420P] = {
.name = "yuv420p", .name = "yuv420p",
@ -266,7 +266,7 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr,
int pix_fmt, int width, int height) int pix_fmt, int width, int height)
{ {
int size, w2, h2, size2; int size, w2, h2, size2;
PixFmtInfo *pinfo; const PixFmtInfo *pinfo;
if(avcodec_check_dimensions(NULL, width, height)) if(avcodec_check_dimensions(NULL, width, height))
goto fail; goto fail;
@ -359,7 +359,7 @@ fail:
int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height,
unsigned char *dest, int dest_size) unsigned char *dest, int dest_size)
{ {
PixFmtInfo* pf = &pix_fmt_info[pix_fmt]; const PixFmtInfo* pf = &pix_fmt_info[pix_fmt];
int i, j, w, h, data_planes; int i, j, w, h, data_planes;
const unsigned char* s; const unsigned char* s;
int size = avpicture_get_size(pix_fmt, width, height); int size = avpicture_get_size(pix_fmt, width, height);
@ -592,7 +592,7 @@ void img_copy(AVPicture *dst, const AVPicture *src,
int pix_fmt, int width, int height) int pix_fmt, int width, int height)
{ {
int bwidth, bits, i; int bwidth, bits, i;
PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
pf = &pix_fmt_info[pix_fmt]; pf = &pix_fmt_info[pix_fmt];
switch(pf->pixel_type) { switch(pf->pixel_type) {
@ -1723,7 +1723,7 @@ typedef struct ConvertEntry {
The other conversion functions are just optimisations for common cases. The other conversion functions are just optimisations for common cases.
*/ */
static ConvertEntry convert_table[PIX_FMT_NB][PIX_FMT_NB] = { static const ConvertEntry convert_table[PIX_FMT_NB][PIX_FMT_NB] = {
[PIX_FMT_YUV420P] = { [PIX_FMT_YUV420P] = {
[PIX_FMT_YUV422] = { [PIX_FMT_YUV422] = {
.convert = yuv420p_to_yuv422, .convert = yuv420p_to_yuv422,
@ -1966,7 +1966,7 @@ void avpicture_free(AVPicture *picture)
} }
/* return true if yuv planar */ /* return true if yuv planar */
static inline int is_yuv_planar(PixFmtInfo *ps) static inline int is_yuv_planar(const PixFmtInfo *ps)
{ {
return (ps->color_type == FF_COLOR_YUV || return (ps->color_type == FF_COLOR_YUV ||
ps->color_type == FF_COLOR_YUV_JPEG) && ps->color_type == FF_COLOR_YUV_JPEG) &&
@ -2055,8 +2055,8 @@ int img_convert(AVPicture *dst, int dst_pix_fmt,
{ {
static int inited; static int inited;
int i, ret, dst_width, dst_height, int_pix_fmt; int i, ret, dst_width, dst_height, int_pix_fmt;
PixFmtInfo *src_pix, *dst_pix; const PixFmtInfo *src_pix, *dst_pix;
ConvertEntry *ce; const ConvertEntry *ce;
AVPicture tmp1, *tmp = &tmp1; AVPicture tmp1, *tmp = &tmp1;
if (src_pix_fmt < 0 || src_pix_fmt >= PIX_FMT_NB || if (src_pix_fmt < 0 || src_pix_fmt >= PIX_FMT_NB ||
@ -2323,7 +2323,7 @@ static int get_alpha_info_pal8(const AVPicture *src, int width, int height)
int img_get_alpha_info(const AVPicture *src, int img_get_alpha_info(const AVPicture *src,
int pix_fmt, int width, int height) int pix_fmt, int width, int height)
{ {
PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
int ret; int ret;
pf = &pix_fmt_info[pix_fmt]; pf = &pix_fmt_info[pix_fmt];

View File

@ -450,7 +450,7 @@ static const char* context_to_name(void* ptr) {
#define E AV_OPT_FLAG_ENCODING_PARAM #define E AV_OPT_FLAG_ENCODING_PARAM
#define D AV_OPT_FLAG_DECODING_PARAM #define D AV_OPT_FLAG_DECODING_PARAM
static AVOption options[]={ static const AVOption options[]={
{"bit_rate", NULL, OFFSET(bit_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E}, {"bit_rate", NULL, OFFSET(bit_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E},
{"bit_rate_tolerance", NULL, OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"bit_rate_tolerance", NULL, OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
{"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|E|D, "flags"}, {"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|A|E|D, "flags"},