70 { 0, 0, 0, 4, 4, 4, 4, 0};
76 { 0x10, 0x13, 0x17, 0x1A, 0x1E, 0x21, 0x25, 0x28,
77 0x2C, 0x2F, 0x33, 0x36, 0x3A, 0x3D, 0x41, 0x44,
78 0x48, 0x4B, 0x4F, 0x52, 0x56, 0x59, 0x5C, 0x60,
79 0x63, 0x67, 0x6A, 0x6E, 0x71, 0x75, 0x78, 0x7C,
80 0x7F, 0x83, 0x86, 0x8A, 0x8D, 0x91, 0x94, 0x98,
81 0x9B, 0x9F, 0xA2, 0xA5, 0xA9, 0xAC, 0xB0, 0xB3,
82 0xB7, 0xBA, 0xBE, 0xC1, 0xC5, 0xC8, 0xCC, 0xCF,
83 0xD3, 0xD6, 0xDA, 0xDD, 0xE1, 0xE4, 0xE8, 0xEB};
86 { 0x60, 0x67, 0x6D, 0x73, 0x7A, 0x80, 0x86, 0x8D,
87 0x93, 0x99, 0xA0, 0xA6, 0xAC, 0xB3, 0xB9, 0xC0};
92 uint8_t *luma,
int chroma)
94 uint8_t *y_plane, *cr_plane, *cb_plane;
98 cr_plane = frame->
data[1] + (x / 4) + (y / 4) * frame->
linesize[1];
99 cb_plane = frame->
data[2] + (x / 4) + (y / 4) * frame->
linesize[2];
106 for(i = 0; i < 16; i++){
116 int f0,
int f1,
int Y0,
int Y1,
int chroma)
120 for(mask = 0x80, i = 0;
mask; mask >>= 1, i++) {
127 for(mask = 0x80, i = 8;
mask; mask >>= 1, i++) {
153 Luma[0] = Y[0]; Luma[1] = Y[1]; Luma[2] = Y[2]; Luma[3] = Y[3];
154 Luma[4] = Y[0]; Luma[5] = Y[1]; Luma[6] = Y[2]; Luma[7] = Y[3];
155 Luma[8] = Y[0]; Luma[9] = Y[1]; Luma[10] = Y[2]; Luma[11] = Y[3];
156 Luma[12] = Y[0]; Luma[13] = Y[1]; Luma[14] = Y[2]; Luma[15] = Y[3];
159 Luma[0] = Y[1]; Luma[1] = Y[2]; Luma[2] = Y[3]; Luma[3] = Y[3];
160 Luma[4] = Y[0]; Luma[5] = Y[1]; Luma[6] = Y[2]; Luma[7] = Y[3];
161 Luma[8] = Y[0]; Luma[9] = Y[1]; Luma[10] = Y[2]; Luma[11] = Y[3];
162 Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[1]; Luma[15] = Y[2];
165 Luma[0] = Y[1]; Luma[1] = Y[2]; Luma[2] = Y[3]; Luma[3] = Y[3];
166 Luma[4] = Y[1]; Luma[5] = Y[2]; Luma[6] = Y[2]; Luma[7] = Y[3];
167 Luma[8] = Y[0]; Luma[9] = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[2];
168 Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[1]; Luma[15] = Y[2];
171 Luma[0] = Y[2]; Luma[1] = Y[3]; Luma[2] = Y[3]; Luma[3] = Y[3];
172 Luma[4] = Y[1]; Luma[5] = Y[2]; Luma[6] = Y[2]; Luma[7] = Y[3];
173 Luma[8] = Y[0]; Luma[9] = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[2];
174 Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[0]; Luma[15] = Y[1];
177 Luma[0] = Y[3]; Luma[1] = Y[3]; Luma[2] = Y[3]; Luma[3] = Y[3];
178 Luma[4] = Y[2]; Luma[5] = Y[2]; Luma[6] = Y[2]; Luma[7] = Y[2];
179 Luma[8] = Y[1]; Luma[9] = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[1];
180 Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[0]; Luma[15] = Y[0];
183 Luma[0] = Y[3]; Luma[1] = Y[3]; Luma[2] = Y[3]; Luma[3] = Y[2];
184 Luma[4] = Y[3]; Luma[5] = Y[2]; Luma[6] = Y[2]; Luma[7] = Y[1];
185 Luma[8] = Y[2]; Luma[9] = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[0];
186 Luma[12] = Y[1]; Luma[13] = Y[0]; Luma[14] = Y[0]; Luma[15] = Y[0];
189 Luma[0] = Y[3]; Luma[1] = Y[3]; Luma[2] = Y[2]; Luma[3] = Y[2];
190 Luma[4] = Y[3]; Luma[5] = Y[2]; Luma[6] = Y[1]; Luma[7] = Y[1];
191 Luma[8] = Y[2]; Luma[9] = Y[2]; Luma[10] = Y[1]; Luma[11] = Y[0];
192 Luma[12] = Y[1]; Luma[13] = Y[1]; Luma[14] = Y[0]; Luma[15] = Y[0];
195 Luma[0] = Y[3]; Luma[1] = Y[3]; Luma[2] = Y[2]; Luma[3] = Y[1];
196 Luma[4] = Y[3]; Luma[5] = Y[2]; Luma[6] = Y[1]; Luma[7] = Y[0];
197 Luma[8] = Y[3]; Luma[9] = Y[2]; Luma[10] = Y[1]; Luma[11] = Y[0];
198 Luma[12] = Y[2]; Luma[13] = Y[1]; Luma[14] = Y[0]; Luma[15] = Y[0];
201 Luma[0] = Y[0]; Luma[1] = Y[0]; Luma[2] = Y[1]; Luma[3] = Y[1];
202 Luma[4] = Y[0]; Luma[5] = Y[0]; Luma[6] = Y[1]; Luma[7] = Y[1];
203 Luma[8] = Y[2]; Luma[9] = Y[2]; Luma[10] = Y[3]; Luma[11] = Y[3];
204 Luma[12] = Y[2]; Luma[13] = Y[2]; Luma[14] = Y[3]; Luma[15] = Y[3];
212 void *
data,
int *data_size,
215 const uint8_t *buf = avpkt->
data;
216 int buf_size = avpkt->
size;
244 idx = bytestream2_get_byteu(&s->
gb);
245 if((idx & 0xF8) == 0x70) {
248 modifier = bytestream2_get_byte(&s->
gb);
250 av_log(avctx,
AV_LOG_INFO,
"warning: modifier must be 0 or 1, got %i\n", modifier);
262 skip = bytestream2_get_byte(&s->
gb);
263 if ((blocks + skip) >= s->
blocks)
267 while(x >= s->
width) {
289 chroma = bytestream2_get_byte(&s->
gb);
292 for (i = 0; i < 4; i++) {
293 code = (idx >> (6 - i*2)) & 3;
297 chroma = bytestream2_get_byte(&s->
gb);
300 ty = y + block_coords[(i * 2) + 1];
303 tmp = bytestream2_get_byte(&s->
gb);
323 tmp = bytestream2_get_be24(&s->
gb);
325 Y[0] = (tmp >> 18) & 0x3F;
326 Y[1] = (tmp >> 12) & 0x3F;
327 Y[2] = (tmp >> 6) & 0x3F;
331 tmp = bytestream2_get_be16(&s->
gb);
333 angle = (tmp >> 12) & 0xF;
349 tmp = bytestream2_get_be24u(&s->
gb);
350 Luma[0] = (tmp >> 18) & 0x3F;
351 Luma[1] = (tmp >> 12) & 0x3F;
352 Luma[2] = (tmp >> 6) & 0x3F;
353 Luma[3] = tmp & 0x3F;
355 tmp = bytestream2_get_be24u(&s->
gb);
356 Luma[4] = (tmp >> 18) & 0x3F;
357 Luma[5] = (tmp >> 12) & 0x3F;
358 Luma[6] = (tmp >> 6) & 0x3F;
359 Luma[7] = tmp & 0x3F;
361 tmp = bytestream2_get_be24u(&s->
gb);
362 Luma[8] = (tmp >> 18) & 0x3F;
363 Luma[9] = (tmp >> 12) & 0x3F;
364 Luma[10] = (tmp >> 6) & 0x3F;
365 Luma[11] = tmp & 0x3F;
367 tmp = bytestream2_get_be24u(&s->
gb);
368 Luma[12] = (tmp >> 18) & 0x3F;
369 Luma[13] = (tmp >> 12) & 0x3F;
370 Luma[14] = (tmp >> 6) & 0x3F;
371 Luma[15] = tmp & 0x3F;
377 tmp = bytestream2_get_byteu(&s->
gb);
379 angle = (tmp >> 4) & 0x7;
380 tmp = (tmp << 8) + bytestream2_get_byteu(&s->
gb);
381 Y[0] = (tmp >> 6) & 0x3F;
383 Y[2] = bytestream2_get_byteu(&s->
gb) & 0x3F;
384 Y[3] = bytestream2_get_byteu(&s->
gb) & 0x3F;
388 f0 = bytestream2_get_byteu(&s->
gb);
390 Y[0] = bytestream2_get_byteu(&s->
gb) & 0x3F;
391 Y[1] = bytestream2_get_byteu(&s->
gb) & 0x3F;
416 "Insufficient data\n");
421 .
name =
"ultimotion",
static int ulti_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define FF_BUFFER_HINTS_VALID
static av_cold int ulti_decode_end(AVCodecContext *avctx)
int buffer_hints
codec suggestion on buffer type if != 0
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
AVFrame * coded_frame
the picture in the bitstream
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
int(* reget_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of a frame to get cr buffer for it.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static const uint16_t mask[17]
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static const unsigned char ulti_codebook[16384]
static const int angle_by_index[4]
int width
picture width / height.
struct AVFrame AVFrame
Audio Video Frame.
#define FF_BUFFER_HINTS_REUSABLE
struct UltimotionDecodeContext UltimotionDecodeContext
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int ulti_decode_init(AVCodecContext *avctx)
#define FF_BUFFER_HINTS_PRESERVE
const uint8_t * ulti_codebook
static void ulti_convert_yuv(AVFrame *frame, int x, int y, uint8_t *luma, int chroma)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static void ulti_grad(AVFrame *frame, int x, int y, uint8_t *Y, int chroma, int angle)
static void ulti_pattern(AVFrame *frame, int x, int y, int f0, int f1, int Y0, int Y1, int chroma)
static const uint8_t ulti_chromas[16]
static const int block_coords[8]
static const uint8_t ulti_lumas[64]