28 #define BITSTREAM_READER_LE
40 const unsigned char *src_end,
41 unsigned char *dst,
int dst_size)
49 for (i = 0, sz = 0; i < 64 && sz < dst_size; i++) {
53 sz +=
FFABS(code_table[i]);
58 for (i = 0; i < 64 && dst_size > 0; i++) {
62 if (src_end - src < 1)
64 memset(dst, *src++,
FFMIN(len, dst_size));
66 if (src_end - src < len)
68 memcpy(dst, src,
FFMIN(len, dst_size));
78 const unsigned char *
src,
79 const unsigned char *src_end,
85 unsigned char block[8 * 8];
87 if (src_end - src < 1)
94 for (b = 0; b < 8; b++) {
95 memcpy(dst, &block[b * 8], 8);
101 for (i = 0; i < 8; i++) {
102 for (b = 0; b < 8; b++)
112 if (src_end - src < len + 8 * bits)
117 for (b = 0; b < 8; b++) {
118 for (i = 0; i < 8; i++)
119 dst[i] = color_table[
get_bits(&gb, bits)];
128 const unsigned char *
src,
129 const unsigned char *src_end,
134 if (src_end - src < 8 * 8)
137 for (i = 0; i < 8; i++) {
147 const unsigned char *
src,
148 const unsigned char *src_end,
154 if (src_end - src < 2)
157 offset = ((pos >> 3) & 7) * seq->
frame->
linesize[0] + (pos & 7);
159 }
while (!(pos & 0x80));
166 const unsigned char *data_end = data + data_size;
176 palette = (uint32_t *)seq->
frame->
data[1];
177 if (data_end - data < 256 * 3)
179 for (i = 0; i < 256; i++) {
180 for (j = 0; j < 3; j++, data++)
181 c[j] = (*data << 2) | (*data >> 4);
182 palette[i] = 0xFF
U << 24 |
AV_RB24(c);
188 if (data_end - data < 128)
191 for (y = 0; y < 128; y += 8)
192 for (x = 0; x < 256; x += 8) {
228 void *
data,
int *got_frame,
232 int buf_size = avpkt->
size;
260 .
name =
"tiertexseqvideo",
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int init(AVCodecContext *avctx)
static av_cold int seqvideo_decode_end(AVCodecContext *avctx)
static av_cold int seqvideo_decode_init(AVCodecContext *avctx)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int data_size)
static int get_sbits(GetBitContext *s, int n)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
8 bits with AV_PIX_FMT_RGB32 palette
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static int get_bits_count(const GetBitContext *s)
bitstream reader API header.
static int get_bits_left(GetBitContext *gb)
static const unsigned char * seq_unpack_rle_block(const unsigned char *src, const unsigned char *src_end, unsigned char *dst, int dst_size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
static const unsigned char * seq_decode_op3(SeqVideoContext *seq, const unsigned char *src, const unsigned char *src_end, unsigned char *dst)
static const uint8_t offset[127][2]
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
Identical in function to av_frame_make_writable(), except it uses ff_get_buffer() to allocate the buf...
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static const unsigned char * seq_decode_op1(SeqVideoContext *seq, const unsigned char *src, const unsigned char *src_end, unsigned char *dst)
const uint8_t ff_log2_tab[256]
Libavcodec external API header.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
static const struct ColorTable color_table[][8]
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
int palette_has_changed
Tell user application that palette has changed from previous frame.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
common internal api header.
static int seqvideo_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const unsigned char * seq_decode_op2(SeqVideoContext *seq, const unsigned char *src, const unsigned char *src_end, unsigned char *dst)
This structure stores compressed data.
AVCodec ff_tiertexseqvideo_decoder
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.