I have underestimated this a little, and these are just some ...
Originally committed as revision 11708 to svn://svn.ffmpeg.org/ffmpeg/trunk
#include "common.h"
#define DEF_T(type, name, bytes, read, write) \
-static av_always_inline type bytestream_get_ ## name(uint8_t **b){\
+static av_always_inline type bytestream_get_ ## name(const uint8_t **b){\
(*b) += bytes;\
return read(*b - bytes);\
}\
#undef DEF64
#undef DEF_T
-static av_always_inline unsigned int bytestream_get_buffer(uint8_t **b, uint8_t *dst, unsigned int size)
+static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, uint8_t *dst, unsigned int size)
{
memcpy(dst, *b, size);
(*b) += size;
static int dnxhd_rc_cmp(const void *a, const void *b)
{
- return ((RCCMPEntry *)b)->value - ((RCCMPEntry *)a)->value;
+ return ((const RCCMPEntry *)b)->value - ((const RCCMPEntry *)a)->value;
}
static int dnxhd_encode_fast(AVCodecContext *avctx, DNXHDEncContext *ctx)
return 0;
}
-static void dnxhd_load_picture(DNXHDEncContext *ctx, AVFrame *frame)
+static void dnxhd_load_picture(DNXHDEncContext *ctx, const AVFrame *frame)
{
int i;
ctx->cur_field = frame->interlaced_frame && !frame->top_field_first;
}
-static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
+static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, const void *data)
{
DNXHDEncContext *ctx = avctx->priv_data;
int first_field = 1;
static int dpcm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
DPCMContext *s = avctx->priv_data;
int in, out = 0;
static int cinvideo_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
CinVideoContext *cin = avctx->priv_data;
int i, y, palette_type, palette_colors_count, bitmap_frame_type, bitmap_frame_size;
static int cinaudio_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
CinAudioContext *cin = avctx->priv_data;
- uint8_t *src = buf;
+ const uint8_t *src = buf;
int16_t *samples = (int16_t *)data;
buf_size = FFMIN(buf_size, *data_size/2);
void ff_float_to_int16_c(int16_t *dst, const float *src, int len){
int i;
for(i=0; i<len; i++) {
- int_fast32_t tmp = ((int32_t*)src)[i];
+ int_fast32_t tmp = ((const int32_t*)src)[i];
if(tmp & 0xf0000){
tmp = (0x43c0ffff - tmp)>>31;
// is this faster on some gcc/cpu combinations?
144000 bytes for PAL - or twice those for 50Mbps) */
static int dvvideo_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
DVVideoContext *s = avctx->priv_data;
}
static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
- uint8_t **srcbuf, int buf_size,
+ const uint8_t **srcbuf, int buf_size,
int non_mod, uint8_t *map_table)
{
GetBitContext gb;
}
static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
- uint8_t **srcbuf, int buf_size,
+ const uint8_t **srcbuf, int buf_size,
int non_mod, uint8_t *map_table)
{
GetBitContext gb;
}
static int dvbsub_read_8bit_string(uint8_t *destbuf, int dbuf_len,
- uint8_t **srcbuf, int buf_size,
+ const uint8_t **srcbuf, int buf_size,
int non_mod, uint8_t *map_table)
{
- uint8_t *sbuf_end = (*srcbuf) + buf_size;
+ const uint8_t *sbuf_end = (*srcbuf) + buf_size;
int bits;
int run_length;
int pixels_read = 0;
static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDisplay *display,
- uint8_t *buf, int buf_size, int top_bottom, int non_mod)
+ const uint8_t *buf, int buf_size, int top_bottom, int non_mod)
{
DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
DVBSubRegion *region = get_region(ctx, display->region_id);
- uint8_t *buf_end = buf + buf_size;
+ const uint8_t *buf_end = buf + buf_size;
uint8_t *pbuf;
int x_pos, y_pos;
int i;
}
static void dvbsub_parse_object_segment(AVCodecContext *avctx,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
- uint8_t *buf_end = buf + buf_size;
- uint8_t *block;
+ const uint8_t *buf_end = buf + buf_size;
+ const uint8_t *block;
int object_id;
DVBSubObject *object;
DVBSubObjectDisplay *display;
}
static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
- uint8_t *buf_end = buf + buf_size;
+ const uint8_t *buf_end = buf + buf_size;
int clut_id;
DVBSubCLUT *clut;
int entry_id, depth , full_range;
static void dvbsub_parse_region_segment(AVCodecContext *avctx,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
- uint8_t *buf_end = buf + buf_size;
+ const uint8_t *buf_end = buf + buf_size;
int region_id, object_id;
DVBSubRegion *region;
DVBSubObject *object;
}
static void dvbsub_parse_page_segment(AVCodecContext *avctx,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
DVBSubRegionDisplay *display;
DVBSubRegionDisplay *tmp_display_list, **tmp_ptr;
- uint8_t *buf_end = buf + buf_size;
+ const uint8_t *buf_end = buf + buf_size;
int region_id;
int page_state;
}
#endif
-static int dvbsub_display_end_segment(AVCodecContext *avctx, uint8_t *buf,
+static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
int buf_size, AVSubtitle *sub)
{
DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
static int dvbsub_decode(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
AVSubtitle *sub = (AVSubtitle*) data;
- uint8_t *p, *p_end;
+ const uint8_t *p, *p_end;
int segment_type;
int page_id;
int segment_length;
static int dvdsub_decode(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
AVSubtitle *sub = (void *)data;
int is_menu;
int gce_delay;
/* LZW compatible decoder */
- uint8_t *bytestream;
- uint8_t *bytestream_end;
+ const uint8_t *bytestream;
+ const uint8_t *bytestream_end;
LZWState *lzw;
/* aux buffers */
return 0;
}
-static int gif_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)
+static int gif_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
{
GifState *s = avctx->priv_data;
AVFrame *picture = data;
DSPContext dsp;
AVFrame frame;
- unsigned char *buf;
+ const unsigned char *buf;
int size;
hnode_t huff_nodes[256][HUF_TOKENS*2];
static int idcin_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
IdcinContext *s = avctx->priv_data;
AVPaletteControl *palette_control = avctx->palctrl;
static int imc_decode_frame(AVCodecContext * avctx,
void *data, int *data_size,
- uint8_t * buf, int buf_size)
+ const uint8_t * buf, int buf_size)
{
IMCContext *q = avctx->priv_data;
static int ir2_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
Ir2Context * const s = avctx->priv_data;
AVFrame *picture = data;
/* ---------------------------------------------------------------------- */
static unsigned long iv_decode_frame(Indeo3DecodeContext *s,
- unsigned char *buf, int buf_size)
+ const unsigned char *buf, int buf_size)
{
unsigned int hdr_width, hdr_height,
chroma_width, chroma_height;
unsigned long fflags1, fflags2, fflags3, offs1, offs2, offs3, offs;
- unsigned char *hdr_pos, *buf_pos;
+ const unsigned char *hdr_pos, *buf_pos;
buf_pos = buf;
buf_pos += 18;
static int indeo3_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- unsigned char *buf, int buf_size)
+ const unsigned char *buf, int buf_size)
{
Indeo3DecodeContext *s=avctx->priv_data;
unsigned char *src, *dest;
AVFrame second_last_frame;
AVFrame last_frame;
AVFrame current_frame;
- unsigned char *decoding_map;
+ const unsigned char *decoding_map;
int decoding_map_size;
- unsigned char *buf;
+ const unsigned char *buf;
int size;
- unsigned char *stream_ptr;
- unsigned char *stream_end;
+ const unsigned char *stream_ptr;
+ const unsigned char *stream_end;
unsigned char *pixel_ptr;
int line_inc;
int stride;
static int ipvideo_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
IpvideoContext *s = avctx->priv_data;
AVPaletteControl *palette_control = avctx->palctrl;
} \
}
-static void kmvc_decode_intra_8x8(KmvcContext * ctx, uint8_t * src, int w, int h)
+static void kmvc_decode_intra_8x8(KmvcContext * ctx, const uint8_t * src, int w, int h)
{
BitBuf bb;
int res, val;
}
}
-static void kmvc_decode_inter_8x8(KmvcContext * ctx, uint8_t * src, int w, int h)
+static void kmvc_decode_inter_8x8(KmvcContext * ctx, const uint8_t * src, int w, int h)
{
BitBuf bb;
int res, val;
}
}
-static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, uint8_t * buf,
+static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, const uint8_t * buf,
int buf_size)
{
KmvcContext *const ctx = avctx->priv_data;
* Decode a frame
*
*/
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
{
LclDecContext * const c = avctx->priv_data;
unsigned char *encoded = (unsigned char *)buf;
}
static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int height,
- int stride, uint8_t *buf, int buf_size, int step)
+ int stride, const uint8_t *buf, int buf_size, int step)
{
RICEContext rc;
int val;
static int decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
LOCOContext * const l = avctx->priv_data;
AVFrame * const p= (AVFrame*)&l->pic;
};
struct LZWState {
- uint8_t *pbuf, *ebuf;
+ const uint8_t *pbuf, *ebuf;
int bbits;
unsigned int bbuf;
return c & s->curmask;
}
-uint8_t* ff_lzw_cur_ptr(LZWState *p)
+const uint8_t* ff_lzw_cur_ptr(LZWState *p)
{
return ((struct LZWState*)p)->pbuf;
}
* @param buf_size input data size
* @param mode decoder working mode - either GIF or TIFF
*/
-int ff_lzw_decode_init(LZWState *p, int csize, uint8_t *buf, int buf_size, int mode)
+int ff_lzw_decode_init(LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode)
{
struct LZWState *s = (struct LZWState *)p;
/* first two functions de/allocate memory for LZWState */
void ff_lzw_decode_open(LZWState **p);
void ff_lzw_decode_close(LZWState **p);
-int ff_lzw_decode_init(LZWState *s, int csize, uint8_t *buf, int buf_size, int mode);
+int ff_lzw_decode_init(LZWState *s, int csize, const uint8_t *buf, int buf_size, int mode);
int ff_lzw_decode(LZWState *s, uint8_t *buf, int len);
-uint8_t* ff_lzw_cur_ptr(LZWState *lzw);
+const uint8_t* ff_lzw_cur_ptr(LZWState *lzw);
void ff_lzw_decode_tail(LZWState *lzw);
/** LZW encode state */
static int mm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
MmContext *s = avctx->priv_data;
AVPaletteControl *palette_control = avctx->palctrl;
static int mpc7_decode_frame(AVCodecContext * avctx,
void *data, int *data_size,
- uint8_t * buf, int buf_size)
+ const uint8_t * buf, int buf_size)
{
MPCContext *c = avctx->priv_data;
GetBitContext gb;
static int mpc8_decode_frame(AVCodecContext * avctx,
void *data, int *data_size,
- uint8_t * buf, int buf_size)
+ const uint8_t * buf, int buf_size)
{
MPCContext *c = avctx->priv_data;
GetBitContext gb2, *gb = &gb2;
static int decode_frame(AVCodecContext * avctx,
void *data, int *data_size,
- uint8_t * buf, int buf_size)
+ const uint8_t * buf, int buf_size)
{
MPADecodeContext *s = avctx->priv_data;
uint32_t header;
#ifdef CONFIG_MP3ADU_DECODER
static int decode_frame_adu(AVCodecContext * avctx,
void *data, int *data_size,
- uint8_t * buf, int buf_size)
+ const uint8_t * buf, int buf_size)
{
MPADecodeContext *s = avctx->priv_data;
uint32_t header;
static int decode_frame_mp3on4(AVCodecContext * avctx,
void *data, int *data_size,
- uint8_t * buf, int buf_size)
+ const uint8_t * buf, int buf_size)
{
MP3On4DecodeContext *s = avctx->priv_data;
MPADecodeContext *m;
OUT_INT decoded_buf[MPA_FRAME_SIZE * MPA_MAX_CHANNELS];
OUT_INT *outptr, *bp;
int fsize;
- unsigned char *start2 = buf, *start;
+ const unsigned char *start2 = buf, *start;
int fr, i, j, n;
int off = avctx->channels;
int *coff = chan_offset[s->chan_cfg];
AVCodecContext *avctx;
AVFrame frame;
- unsigned char *buf;
+ const unsigned char *buf;
int size;
} MsrleContext;
static int msrle_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
MsrleContext *s = avctx->priv_data;
DSPContext dsp;
AVFrame frame;
- unsigned char *buf;
+ const unsigned char *buf;
int size;
int mode_8bit; /* if it's not 8-bit, it's 16-bit */
static int msvideo1_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
Msvideo1Context *s = avctx->priv_data;
}
}
-void nelly_decode_block(NellyMoserDecodeContext *s, unsigned char block[NELLY_BLOCK_LEN], float audio[NELLY_SAMPLES])
+void nelly_decode_block(NellyMoserDecodeContext *s, const unsigned char block[NELLY_BLOCK_LEN], float audio[NELLY_SAMPLES])
{
int i,j;
float buf[NELLY_FILL_LEN], pows[NELLY_FILL_LEN];
static int decode_tag(AVCodecContext * avctx,
void *data, int *data_size,
- uint8_t * buf, int buf_size) {
+ const uint8_t * buf, int buf_size) {
NellyMoserDecodeContext *s = avctx->priv_data;
int blocks, i;
int16_t* samples;
}
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
- uint8_t *buf, int buf_size) {
+ const uint8_t *buf, int buf_size) {
NuvContext *c = avctx->priv_data;
AVFrame *picture = data;
int orig_size = buf_size;
* \param src_len number of bytes in src
*/
static inline void decode_to16(int bps, int le, int us,
- uint8_t **src, short **samples, int src_len)
+ const uint8_t **src, short **samples, int src_len)
{
int usum = us ? -0x8000 : 0;
register int n = src_len / bps;
static int pcm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
PCMDecode *s = avctx->priv_data;
int c, n;
short *samples;
- uint8_t *src, *src2[MAX_CHANNELS];
+ const uint8_t *src, *src2[MAX_CHANNELS];
samples = data;
src = buf;
int vqid, bpos, xpos, ypos, xp, yp, x, y, mx, my;
int frame_stats[2][4] = {{0},{0}};
roq_qcell *qcell;
- unsigned char *buf = ri->buf;
+ const unsigned char *buf = ri->buf;
unsigned char *buf_end = ri->buf + ri->size;
while (buf < buf_end) {
* @param pixelstride pixel stride of input buffer
* @return size of output in bytes, -1 if buffer overflows
*/
-static int expand_rle_row(uint8_t *in_buf, uint8_t* in_end,
+static int expand_rle_row(const uint8_t *in_buf, const uint8_t* in_end,
unsigned char *out_buf, uint8_t* out_end, int pixelstride)
{
unsigned char pixel, count;
* @param s the current image state
* @return 0 if no error, else return error number.
*/
-static int read_rle_sgi(unsigned char* out_buf, uint8_t *in_buf,
- uint8_t *in_end, SgiState* s)
+static int read_rle_sgi(unsigned char* out_buf, const uint8_t *in_buf,
+ const uint8_t *in_end, SgiState* s)
{
uint8_t *dest_row;
unsigned int len = s->height * s->depth * 4;
- uint8_t *start_table = in_buf;
+ const uint8_t *start_table = in_buf;
unsigned int y, z;
unsigned int start_offset;
* @return 0 if read success, otherwise return -1.
*/
static int read_uncompressed_sgi(unsigned char* out_buf, uint8_t* out_end,
- uint8_t *in_buf, uint8_t *in_end, SgiState* s)
+ const uint8_t *in_buf, const uint8_t *in_end, SgiState* s)
{
int x, y, z;
- uint8_t *ptr;
+ const uint8_t *ptr;
unsigned int offset = s->height * s->width;
/* Test buffer size. */
static int decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *in_buf, int buf_size)
+ const uint8_t *in_buf, int buf_size)
{
SgiState *s = avctx->priv_data;
AVFrame *picture = data;
AVFrame *p = &s->picture;
- uint8_t *in_end = in_buf + buf_size;
+ const uint8_t *in_end = in_buf + buf_size;
unsigned int dimension, bytes_per_channel, rle;
int ret = 0;
uint8_t *out_buf, *out_end;
static int ulti_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
- uint8_t *buf, int buf_size)
+ const uint8_t *buf, int buf_size)
{
UltimotionDecodeContext *s=avctx->priv_data;
int modifier = 0;
uint8_t *frame, *prev_frame;
uint32_t pal[256];
- uint8_t *stream;
+ const uint8_t *stream;
} VBDecContext;
static const uint16_t vb_patterns[64] = {
return buf >= start && (buf + 4) <= end;
}
-static int vb_decode_framedata(VBDecContext *c, uint8_t *buf, int offset)
+static int vb_decode_framedata(VBDecContext *c, const uint8_t *buf, int offset)
{
uint8_t *prev, *cur;
int blk, blocks, t, blk2;
return 0;
}
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)
+static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
{
VBDecContext * const c = avctx->priv_data;
uint8_t *outptr, *srcptr;
static const uint8_t tc_offsets[9] = { 0, 1, 3, 4, 6, 7, 9, 10, 11 };
static const uint8_t tc_muls[9] = { 10, 6, 10, 6, 10, 6, 10, 10, 1 };
-static uint64_t parse_timecode(uint8_t *buf) {
+static uint64_t parse_timecode(const uint8_t *buf) {
int i;
int64_t ms = 0;
if (buf[2] != ':' || buf[5] != ':' || buf[8] != '.')
}
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
- uint8_t *buf, int buf_size) {
+ const uint8_t *buf, int buf_size) {
AVSubtitle *sub = data;
- uint8_t *buf_end = buf + buf_size;
+ const uint8_t *buf_end = buf + buf_size;
uint8_t *bitmap;
int w, h, x, y, rlelen, i;
GetBitContext gb;