Go to the documentation of this file.
35 #define KMVC_KEYFRAME 0x80
36 #define KMVC_PALETTE 0x40
37 #define KMVC_METHOD 0x0F
38 #define MAX_PALSIZE 256
59 #define BLK(data, x, y) data[av_clip((x) + (y) * 320, 0, 320 * 200 -1)]
61 #define kmvc_init_getbits(bb, g) bb.bits = 7; bb.bitbuf = bytestream2_get_byte(g);
63 #define kmvc_getbit(bb, g, res) {\
65 if (bb.bitbuf & (1 << bb.bits)) res = 1; \
68 bb.bitbuf = bytestream2_get_byte(g); \
79 int l0x, l1x, l0y, l1y;
84 for (by = 0; by <
h; by += 8)
85 for (bx = 0; bx <
w; bx += 8) {
92 val = bytestream2_get_byte(&
ctx->g);
93 for (
i = 0;
i < 64;
i++)
96 for (
i = 0;
i < 4;
i++) {
97 l0x = bx + (
i & 1) * 4;
98 l0y = by + (
i & 2) * 2;
103 val = bytestream2_get_byte(&
ctx->g);
104 for (j = 0; j < 16; j++)
105 BLK(
ctx->cur, l0x + (j & 3), l0y + (j >> 2)) =
val;
107 val = bytestream2_get_byte(&
ctx->g);
110 if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 320*197 - 4) {
114 for (j = 0; j < 16; j++)
115 BLK(
ctx->cur, l0x + (j & 3), l0y + (j >> 2)) =
116 BLK(
ctx->cur, l0x + (j & 3) - mx, l0y + (j >> 2) - my);
119 for (j = 0; j < 4; j++) {
120 l1x = l0x + (j & 1) * 2;
126 val = bytestream2_get_byte(&
ctx->g);
132 val = bytestream2_get_byte(&
ctx->g);
135 if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 320*199 - 2) {
139 BLK(
ctx->cur, l1x, l1y) =
BLK(
ctx->cur, l1x - mx, l1y - my);
140 BLK(
ctx->cur, l1x + 1, l1y) =
141 BLK(
ctx->cur, l1x + 1 - mx, l1y - my);
142 BLK(
ctx->cur, l1x, l1y + 1) =
143 BLK(
ctx->cur, l1x - mx, l1y + 1 - my);
144 BLK(
ctx->cur, l1x + 1, l1y + 1) =
145 BLK(
ctx->cur, l1x + 1 - mx, l1y + 1 - my);
148 BLK(
ctx->cur, l1x, l1y) = bytestream2_get_byte(&
ctx->g);
149 BLK(
ctx->cur, l1x + 1, l1y) = bytestream2_get_byte(&
ctx->g);
150 BLK(
ctx->cur, l1x, l1y + 1) = bytestream2_get_byte(&
ctx->g);
151 BLK(
ctx->cur, l1x + 1, l1y + 1) = bytestream2_get_byte(&
ctx->g);
168 int l0x, l1x, l0y, l1y;
173 for (by = 0; by <
h; by += 8)
174 for (bx = 0; bx <
w; bx += 8) {
183 val = bytestream2_get_byte(&
ctx->g);
184 for (
i = 0;
i < 64;
i++)
185 BLK(
ctx->cur, bx + (
i & 0x7), by + (
i >> 3)) =
val;
187 for (
i = 0;
i < 64;
i++)
188 BLK(
ctx->cur, bx + (
i & 0x7), by + (
i >> 3)) =
189 BLK(
ctx->prev, bx + (
i & 0x7), by + (
i >> 3));
196 for (
i = 0;
i < 4;
i++) {
197 l0x = bx + (
i & 1) * 4;
198 l0y = by + (
i & 2) * 2;
203 val = bytestream2_get_byte(&
ctx->g);
204 for (j = 0; j < 16; j++)
205 BLK(
ctx->cur, l0x + (j & 3), l0y + (j >> 2)) =
val;
207 val = bytestream2_get_byte(&
ctx->g);
208 mx = (
val & 0xF) - 8;
210 if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 320*197 - 4) {
214 for (j = 0; j < 16; j++)
215 BLK(
ctx->cur, l0x + (j & 3), l0y + (j >> 2)) =
216 BLK(
ctx->prev, l0x + (j & 3) + mx, l0y + (j >> 2) + my);
219 for (j = 0; j < 4; j++) {
220 l1x = l0x + (j & 1) * 2;
226 val = bytestream2_get_byte(&
ctx->g);
232 val = bytestream2_get_byte(&
ctx->g);
233 mx = (
val & 0xF) - 8;
235 if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 320*199 - 2) {
239 BLK(
ctx->cur, l1x, l1y) =
BLK(
ctx->prev, l1x + mx, l1y + my);
240 BLK(
ctx->cur, l1x + 1, l1y) =
241 BLK(
ctx->prev, l1x + 1 + mx, l1y + my);
242 BLK(
ctx->cur, l1x, l1y + 1) =
243 BLK(
ctx->prev, l1x + mx, l1y + 1 + my);
244 BLK(
ctx->cur, l1x + 1, l1y + 1) =
245 BLK(
ctx->prev, l1x + 1 + mx, l1y + 1 + my);
248 BLK(
ctx->cur, l1x, l1y) = bytestream2_get_byte(&
ctx->g);
249 BLK(
ctx->cur, l1x + 1, l1y) = bytestream2_get_byte(&
ctx->g);
250 BLK(
ctx->cur, l1x, l1y + 1) = bytestream2_get_byte(&
ctx->g);
251 BLK(
ctx->cur, l1x + 1, l1y + 1) = bytestream2_get_byte(&
ctx->g);
276 #if FF_API_PALETTE_HAS_CHANGED
281 #if FF_API_PALETTE_HAS_CHANGED
288 if (bytestream2_peek_byte(&
ctx->g) == 127) {
290 for (
i = 0;
i < 127;
i++) {
291 ctx->pal[
i + (
header & 0x81)] = 0xFFU << 24 | bytestream2_get_be24(&
ctx->g);
306 #if FF_API_PALETTE_HAS_CHANGED
312 for (
i = 1;
i <=
ctx->palsize;
i++) {
313 ctx->pal[
i] = 0xFF
U << 24 | bytestream2_get_be24(&
ctx->g);
319 #if FF_API_PALETTE_HAS_CHANGED
329 blocksize = bytestream2_get_byte(&
ctx->g);
331 if (blocksize != 8 && blocksize != 127) {
335 memset(
ctx->cur, 0, 320 * 200);
339 memcpy(
ctx->cur,
ctx->prev, 320 * 200);
389 for (
i = 0;
i < 256;
i++) {
390 c->pal[
i] = 0xFF
U << 24 |
i * 0x10101;
395 "Extradata missing, decoding may not work properly...\n");
408 for (
i = 0;
i < 256;
i++) {
#define FF_ENABLE_DEPRECATION_WARNINGS
#define AV_LOG_WARNING
Something somehow does not look correct.
attribute_deprecated int palette_has_changed
Tell user application that palette has changed from previous frame.
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 av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
This structure describes decoded (raw) audio or video data.
static int kmvc_decode_intra_8x8(KmvcContext *ctx, int w, int h)
const FFCodec ff_kmvc_decoder
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
AVCodec p
The public AVCodec.
static double val(void *priv, double ch)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define FF_CODEC_DECODE_CB(func)
#define kmvc_getbit(bb, g, res)
int(* init)(AVBSFContext *ctx)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
#define CODEC_LONG_NAME(str)
@ AV_PICTURE_TYPE_I
Intra.
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
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
enum AVPictureType pict_type
Picture type of the frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static const uint8_t header[24]
#define i(width, name, range_min, range_max)
#define kmvc_init_getbits(bb, g)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
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
#define FFSWAP(type, a, b)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
uint32_t pal[MAX_PALSIZE]
main external API structure.
#define FF_DISABLE_DEPRECATION_WARNINGS
@ AV_PICTURE_TYPE_P
Predicted.
This structure stores compressed data.
static int kmvc_decode_inter_8x8(KmvcContext *ctx, int w, int h)
int width
picture width / height.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
static av_cold int decode_init(AVCodecContext *avctx)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
Check whether the side-data of src contains a palette of size AVPALETTE_SIZE; if so,...