Go to the documentation of this file.
52 s->blocks = (
s->width / 8) * (
s->height / 8);
75 { 0, 0, 0, 4, 4, 4, 4, 0};
81 { 0x10, 0x13, 0x17, 0x1A, 0x1E, 0x21, 0x25, 0x28,
82 0x2C, 0x2F, 0x33, 0x36, 0x3A, 0x3D, 0x41, 0x44,
83 0x48, 0x4B, 0x4F, 0x52, 0x56, 0x59, 0x5C, 0x60,
84 0x63, 0x67, 0x6A, 0x6E, 0x71, 0x75, 0x78, 0x7C,
85 0x7F, 0x83, 0x86, 0x8A, 0x8D, 0x91, 0x94, 0x98,
86 0x9B, 0x9F, 0xA2, 0xA5, 0xA9, 0xAC, 0xB0, 0xB3,
87 0xB7, 0xBA, 0xBE, 0xC1, 0xC5, 0xC8, 0xCC, 0xCF,
88 0xD3, 0xD6, 0xDA, 0xDD, 0xE1, 0xE4, 0xE8, 0xEB};
91 { 0x60, 0x67, 0x6D, 0x73, 0x7A, 0x80, 0x86, 0x8D,
92 0x93, 0x99, 0xA0, 0xA6, 0xAC, 0xB3, 0xB9, 0xC0};
99 uint8_t *y_plane, *cr_plane, *cb_plane;
102 y_plane =
frame->data[0] + x + y *
frame->linesize[0];
103 cr_plane =
frame->data[1] + (x / 4) + (y / 4) *
frame->linesize[1];
104 cb_plane =
frame->data[2] + (x / 4) + (y / 4) *
frame->linesize[2];
111 for(
i = 0;
i < 16;
i++){
114 y_plane +=
frame->linesize[0];
121 int f0,
int f1,
int Y0,
int Y1,
int chroma)
158 Luma[0] =
Y[0]; Luma[1] =
Y[1]; Luma[2] =
Y[2]; Luma[3] =
Y[3];
159 Luma[4] =
Y[0]; Luma[5] =
Y[1]; Luma[6] =
Y[2]; Luma[7] =
Y[3];
160 Luma[8] =
Y[0]; Luma[9] =
Y[1]; Luma[10] =
Y[2]; Luma[11] =
Y[3];
161 Luma[12] =
Y[0]; Luma[13] =
Y[1]; Luma[14] =
Y[2]; Luma[15] =
Y[3];
164 Luma[0] =
Y[1]; Luma[1] =
Y[2]; Luma[2] =
Y[3]; Luma[3] =
Y[3];
165 Luma[4] =
Y[0]; Luma[5] =
Y[1]; Luma[6] =
Y[2]; Luma[7] =
Y[3];
166 Luma[8] =
Y[0]; Luma[9] =
Y[1]; Luma[10] =
Y[2]; Luma[11] =
Y[3];
167 Luma[12] =
Y[0]; Luma[13] =
Y[0]; Luma[14] =
Y[1]; Luma[15] =
Y[2];
170 Luma[0] =
Y[1]; Luma[1] =
Y[2]; Luma[2] =
Y[3]; Luma[3] =
Y[3];
171 Luma[4] =
Y[1]; Luma[5] =
Y[2]; Luma[6] =
Y[2]; Luma[7] =
Y[3];
172 Luma[8] =
Y[0]; Luma[9] =
Y[1]; Luma[10] =
Y[1]; Luma[11] =
Y[2];
173 Luma[12] =
Y[0]; Luma[13] =
Y[0]; Luma[14] =
Y[1]; Luma[15] =
Y[2];
176 Luma[0] =
Y[2]; Luma[1] =
Y[3]; Luma[2] =
Y[3]; Luma[3] =
Y[3];
177 Luma[4] =
Y[1]; Luma[5] =
Y[2]; Luma[6] =
Y[2]; Luma[7] =
Y[3];
178 Luma[8] =
Y[0]; Luma[9] =
Y[1]; Luma[10] =
Y[1]; Luma[11] =
Y[2];
179 Luma[12] =
Y[0]; Luma[13] =
Y[0]; Luma[14] =
Y[0]; Luma[15] =
Y[1];
182 Luma[0] =
Y[3]; Luma[1] =
Y[3]; Luma[2] =
Y[3]; Luma[3] =
Y[3];
183 Luma[4] =
Y[2]; Luma[5] =
Y[2]; Luma[6] =
Y[2]; Luma[7] =
Y[2];
184 Luma[8] =
Y[1]; Luma[9] =
Y[1]; Luma[10] =
Y[1]; Luma[11] =
Y[1];
185 Luma[12] =
Y[0]; Luma[13] =
Y[0]; Luma[14] =
Y[0]; Luma[15] =
Y[0];
188 Luma[0] =
Y[3]; Luma[1] =
Y[3]; Luma[2] =
Y[3]; Luma[3] =
Y[2];
189 Luma[4] =
Y[3]; Luma[5] =
Y[2]; Luma[6] =
Y[2]; Luma[7] =
Y[1];
190 Luma[8] =
Y[2]; Luma[9] =
Y[1]; Luma[10] =
Y[1]; Luma[11] =
Y[0];
191 Luma[12] =
Y[1]; Luma[13] =
Y[0]; Luma[14] =
Y[0]; Luma[15] =
Y[0];
194 Luma[0] =
Y[3]; Luma[1] =
Y[3]; Luma[2] =
Y[2]; Luma[3] =
Y[2];
195 Luma[4] =
Y[3]; Luma[5] =
Y[2]; Luma[6] =
Y[1]; Luma[7] =
Y[1];
196 Luma[8] =
Y[2]; Luma[9] =
Y[2]; Luma[10] =
Y[1]; Luma[11] =
Y[0];
197 Luma[12] =
Y[1]; Luma[13] =
Y[1]; Luma[14] =
Y[0]; Luma[15] =
Y[0];
200 Luma[0] =
Y[3]; Luma[1] =
Y[3]; Luma[2] =
Y[2]; Luma[3] =
Y[1];
201 Luma[4] =
Y[3]; Luma[5] =
Y[2]; Luma[6] =
Y[1]; Luma[7] =
Y[0];
202 Luma[8] =
Y[3]; Luma[9] =
Y[2]; Luma[10] =
Y[1]; Luma[11] =
Y[0];
203 Luma[12] =
Y[2]; Luma[13] =
Y[1]; Luma[14] =
Y[0]; Luma[15] =
Y[0];
206 Luma[0] =
Y[0]; Luma[1] =
Y[0]; Luma[2] =
Y[1]; Luma[3] =
Y[1];
207 Luma[4] =
Y[0]; Luma[5] =
Y[0]; Luma[6] =
Y[1]; Luma[7] =
Y[1];
208 Luma[8] =
Y[2]; Luma[9] =
Y[2]; Luma[10] =
Y[3]; Luma[11] =
Y[3];
209 Luma[12] =
Y[2]; Luma[13] =
Y[2]; Luma[14] =
Y[3]; Luma[15] =
Y[3];
217 void *
data,
int *got_frame,
220 const uint8_t *buf = avpkt->
data;
221 int buf_size = avpkt->
size;
240 if(blocks >=
s->blocks || y >=
s->height)
245 idx = bytestream2_get_byteu(&
s->gb);
246 if((idx & 0xF8) == 0x70) {
249 modifier = bytestream2_get_byte(&
s->gb);
251 av_log(avctx,
AV_LOG_INFO,
"warning: modifier must be 0 or 1, got %i\n", modifier);
263 skip = bytestream2_get_byte(&
s->gb);
264 if ((blocks + skip) >=
s->blocks)
268 while(x >=
s->width) {
290 chroma = bytestream2_get_byte(&
s->gb);
293 for (
i = 0;
i < 4;
i++) {
294 code = (idx >> (6 -
i*2)) & 3;
298 chroma = bytestream2_get_byte(&
s->gb);
304 tmp = bytestream2_get_byte(&
s->gb);
324 tmp = bytestream2_get_be24(&
s->gb);
326 Y[0] = (
tmp >> 18) & 0x3F;
327 Y[1] = (
tmp >> 12) & 0x3F;
328 Y[2] = (
tmp >> 6) & 0x3F;
332 tmp = bytestream2_get_be16(&
s->gb);
334 angle = (
tmp >> 12) & 0xF;
337 Y[0] =
s->ulti_codebook[
tmp];
338 Y[1] =
s->ulti_codebook[
tmp + 1];
339 Y[2] =
s->ulti_codebook[
tmp + 2];
340 Y[3] =
s->ulti_codebook[
tmp + 3];
350 tmp = bytestream2_get_be24u(&
s->gb);
351 Luma[0] = (
tmp >> 18) & 0x3F;
352 Luma[1] = (
tmp >> 12) & 0x3F;
353 Luma[2] = (
tmp >> 6) & 0x3F;
354 Luma[3] =
tmp & 0x3F;
356 tmp = bytestream2_get_be24u(&
s->gb);
357 Luma[4] = (
tmp >> 18) & 0x3F;
358 Luma[5] = (
tmp >> 12) & 0x3F;
359 Luma[6] = (
tmp >> 6) & 0x3F;
360 Luma[7] =
tmp & 0x3F;
362 tmp = bytestream2_get_be24u(&
s->gb);
363 Luma[8] = (
tmp >> 18) & 0x3F;
364 Luma[9] = (
tmp >> 12) & 0x3F;
365 Luma[10] = (
tmp >> 6) & 0x3F;
366 Luma[11] =
tmp & 0x3F;
368 tmp = bytestream2_get_be24u(&
s->gb);
369 Luma[12] = (
tmp >> 18) & 0x3F;
370 Luma[13] = (
tmp >> 12) & 0x3F;
371 Luma[14] = (
tmp >> 6) & 0x3F;
372 Luma[15] =
tmp & 0x3F;
378 tmp = bytestream2_get_byteu(&
s->gb);
380 angle = (
tmp >> 4) & 0x7;
381 tmp = (
tmp << 8) + bytestream2_get_byteu(&
s->gb);
382 Y[0] = (
tmp >> 6) & 0x3F;
384 Y[2] = bytestream2_get_byteu(&
s->gb) & 0x3F;
385 Y[3] = bytestream2_get_byteu(&
s->gb) & 0x3F;
389 int f1 = bytestream2_get_byteu(&
s->gb);
390 Y[0] = bytestream2_get_byteu(&
s->gb) & 0x3F;
391 Y[1] = bytestream2_get_byteu(&
s->gb) & 0x3F;
417 "Insufficient data\n");
422 .
name =
"ultimotion",
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
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 void ulti_convert_yuv(AVFrame *frame, int x, int y, uint8_t *luma, int chroma)
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 const int angle_by_index[4]
static av_cold int ulti_decode_init(AVCodecContext *avctx)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint16_t mask[17]
static int ulti_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static av_cold int ulti_decode_end(AVCodecContext *avctx)
static void ulti_grad(AVFrame *frame, int x, int y, uint8_t *Y, int chroma, int angle)
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
const uint8_t * ulti_codebook
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static const uint8_t ulti_chromas[16]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
static void ulti_pattern(AVFrame *frame, int x, int y, int f0, int f1, int Y0, int Y1, int chroma)
#define AV_LOG_INFO
Standard information.
static const int block_coords[8]
#define i(width, name, range_min, range_max)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static const uint8_t ulti_lumas[64]
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.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
main external API structure.
This structure stores compressed data.
int width
picture width / height.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static const unsigned char ulti_codebook[16384]
const AVCodec ff_ulti_decoder