FFmpeg: libavcodec/tiertexseqv.c Source File
Go to the documentation of this file. 1 /*
2 * Tiertex Limited SEQ Video Decoder
3 * Copyright (c) 2006 Gregory Montoir (cyx@users.sourceforge.net)
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * Tiertex Limited SEQ video decoder
25 */
26
27 #define BITSTREAM_READER_LE
32
33
38
39
41 const unsigned char *src_end,
42 unsigned char *
dst,
int dst_size)
43 {
46 int code_table[64];
47
48 /* get the rle codes */
50 for (
i = 0, sz = 0;
i < 64 && sz < dst_size;
i++) {
54 sz +=
FFABS(code_table[
i]);
55 }
57
58 /* do the rle unpacking */
59 for (
i = 0; i < 64 && dst_size > 0;
i++) {
63 if (src_end -
src < 1)
66 } else {
71 }
74 }
76 }
77
79 const unsigned char *
src,
80 const unsigned char *src_end,
82 {
86 unsigned char block[8 * 8];
87
88 if (src_end -
src < 1)
93 case 1:
95 for (
b = 0;
b < 8;
b++) {
98 }
99 break;
100 case 2:
102 for (
i = 0;
i < 8;
i++) {
103 for (
b = 0;
b < 8;
b++)
106 }
107 break;
108 }
109 } else {
118 for (
b = 0;
b < 8;
b++) {
119 for (
i = 0;
i < 8;
i++)
122 }
123 }
124
126 }
127
129 const unsigned char *
src,
130 const unsigned char *src_end,
132 {
134
135 if (src_end -
src < 8 * 8)
137
138 for (
i = 0;
i < 8;
i++) {
142 }
143
145 }
146
148 const unsigned char *
src,
149 const unsigned char *src_end,
151 {
153
154 do {
155 if (src_end -
src < 2)
160 }
while (!(
pos & 0x80));
161
163 }
164
166 {
167 const unsigned char *data_end =
data + data_size;
172 uint32_t *palette;
173
175
177 palette = (uint32_t *)seq->
frame->
data[1];
178 if (data_end -
data < 256 * 3)
180 for (
i = 0;
i < 256;
i++) {
181 for (j = 0; j < 3; j++,
data++)
184 }
185 }
186
188 if (data_end -
data < 128)
191 for (y = 0; y < 128; y += 8)
192 for (x = 0; x < 256; x += 8) {
196 case 1:
198 break;
199 case 2:
201 break;
202 case 3:
204 break;
205 }
208 }
209 }
210 return 0;
211 }
212
214 {
217
220
224
228
229 return 0;
230 }
231
234 {
235 const uint8_t *buf = avpkt->
data;
236 int buf_size = avpkt->
size;
238
240
243
246
249 *got_frame = 1;
250
251 return buf_size;
252 }
253
255 {
257
259
260 return 0;
261 }
262
264 .
p.
name =
"tiertexseqvideo",
273 };
static int get_bits_left(GetBitContext *gb)
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int get_bits_count(const GetBitContext *s)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
static av_cold int seqvideo_decode_end(AVCodecContext *avctx)
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_cold void close(AVCodecParserContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
AVCodec p
The public AVCodec.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define FF_CODEC_DECODE_CB(func)
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.
static int get_sbits(GetBitContext *s, int n)
@ AV_CODEC_ID_TIERTEXSEQVIDEO
#define CODEC_LONG_NAME(str)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
const uint8_t ff_log2_tab[256]
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static av_cold int seqvideo_decode_init(AVCodecContext *avctx)
static const unsigned char * seq_unpack_rle_block(const unsigned char *src, const unsigned char *src_end, unsigned char *dst, int dst_size)
static const unsigned char * seq_decode_op1(SeqVideoContext *seq, const unsigned char *src, const unsigned char *src_end, unsigned char *dst)
#define i(width, name, range_min, range_max)
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Identical in function to ff_get_buffer(), except it reuses the existing buffer if available.
static const unsigned char * seq_decode_op3(SeqVideoContext *seq, const unsigned char *src, const unsigned char *src_end, unsigned char *dst)
static const unsigned char * seq_decode_op2(SeqVideoContext *seq, const unsigned char *src, const unsigned char *src_end, unsigned char *dst)
static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int data_size)
main external API structure.
const FFCodec ff_tiertexseqvideo_decoder
static int seqvideo_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
This structure stores compressed data.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
The exact code depends on how similar the blocks are and how related they are to the block
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
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 ColorEntry color_table[]
Generated on Sat Oct 18 2025 19:22:40 for FFmpeg by
doxygen
1.8.17