57 1, 2, 2, 2, 3, 3, 3, 4,
58 2, 2, 2, 3, 3, 3, 4, 4,
59 2, 2, 3, 3, 3, 4, 4, 4,
60 2, 2, 3, 3, 3, 4, 4, 5,
61 2, 3, 3, 3, 4, 4, 5, 6,
62 3, 3, 3, 4, 4, 5, 6, 7,
63 3, 3, 3, 4, 4, 5, 7, 7,
64 3, 3, 4, 4, 5, 7, 7, 7,
68 1, 5, 6, 7, 8, 9, 9, 11,
69 5, 5, 7, 8, 9, 9, 11, 12,
70 6, 7, 8, 9, 9, 11, 11, 12,
71 7, 7, 8, 9, 9, 11, 12, 13,
72 7, 8, 9, 9, 10, 11, 13, 16,
73 8, 9, 9, 10, 11, 13, 16, 19,
74 8, 9, 9, 11, 12, 15, 18, 23,
75 9, 9, 11, 12, 15, 18, 23, 27
80 #define FIC_HEADER_SIZE 27
84 const int t0 = 27246 * blk[3 * step] + 18405 * blk[5 * step];
85 const int t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step];
86 const int t2 = 6393 * blk[7 * step] + 32139 * blk[1 * step];
87 const int t3 = 6393 * blk[1 * step] - 32139 * blk[7 * step];
88 const int t4 = 5793 * (t2 + t0 + 0x800 >> 12);
89 const int t5 = 5793 * (t3 + t1 + 0x800 >> 12);
90 const int t6 = t2 -
t0;
91 const int t7 = t3 -
t1;
92 const int t8 = 17734 * blk[2 * step] - 42813 * blk[6 * step];
93 const int t9 = 17734 * blk[6 * step] + 42814 * blk[2 * step];
94 const int tA = (blk[0 * step] - blk[4 * step] << 15) + rnd;
95 const int tB = (blk[0 * step] + blk[4 * step] << 15) + rnd;
96 blk[0 * step] = ( t4 + t9 + tB) >> shift;
97 blk[1 * step] = ( t6 + t7 + t8 + tA) >> shift;
98 blk[2 * step] = ( t6 - t7 - t8 + tA) >> shift;
99 blk[3 * step] = ( t5 - t9 + tB) >> shift;
100 blk[4 * step] = ( -t5 - t9 + tB) >> shift;
101 blk[5 * step] = (-(t6 -
t7) - t8 + tA) >>
shift;
102 blk[6 * step] = (-(t6 +
t7) + t8 + tA) >>
shift;
103 blk[7 * step] = ( -t4 + t9 + tB) >> shift;
112 fic_idct(ptr++, 8, 13, (1 << 12) + (1 << 17));
113 for (i = 1; i < 8; i++) {
119 for (i = 0; i < 8; i++) {
125 for (j = 0; j < 8; j++) {
126 for (i = 0; i < 8; i++)
127 dst[i] = av_clip_uint8(ptr[i]);
146 memset(block, 0,
sizeof(*block) * 64);
152 for (i = 0; i < num_coeff; i++)
169 int y_off = tctx->
y_off;
174 for (p = 0; p < 3; p++) {
178 for (y = 0; y < (slice_h >> !!p); y += 8) {
198 for (i = 0; i <
size; i++)
199 dst[i] += ((src[i] - dst[i]) * alpha[i]) >> 8;
212 for (i = 0; i < 1024; i++) {
213 planes[0][i] = (( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16;
214 planes[1][i] = ((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128;
215 planes[2][i] = ((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128;
216 planes[3][i] = ptr[3];
222 for (i = 0; i < 32; i += 2)
223 for (j = 0; j < 32; j += 2)
224 for (p = 0; p < 3; p++)
225 chroma[p][16 * (i / 2) + j / 2] = (planes[p + 1][32 * i + j ] +
226 planes[p + 1][32 * i + j + 1] +
227 planes[p + 1][32 * (i + 1) + j ] +
228 planes[p + 1][32 * (i + 1) + j + 1]) / 4;
231 for (i = 0; i < 3; i++)
234 (cur_x >> !!i) + !!i;
237 for (i = 0; i <
FFMIN(32, avctx->
height - cur_y) - 1; i += 2) {
239 int csize = lsize / 2;
242 planes[0] + i * 32, lsize, planes[3] + i * 32);
244 planes[0] + (i + 1) * 32, lsize, planes[3] + (i + 1) * 32);
246 chroma[0] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
248 chroma[1] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
304 "Packet is too small to contain cursor (%d vs %d bytes).\n",
312 if (!skip_cursor && tsize < 32) {
314 "Cursor data too small. Skipping cursor.\n");
321 if (!skip_cursor && (cur_x > avctx->
width || cur_y > avctx->
height)) {
323 "Invalid cursor position: (%d,%d). Skipping cusor.\n",
328 if (!skip_cursor && (
AV_RL16(src + 37) != 32 ||
AV_RL16(src + 39) != 32)) {
330 "Invalid cursor size. Skipping cursor.\n");
366 for (slice = 0; slice < nslices; slice++) {
367 unsigned slice_off =
AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4);
369 int y_off = ctx->
slice_h * slice;
376 if (slice == nslices - 1) {
380 slice_size =
AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4);
383 if (slice_size < slice_off || slice_size > msize)
386 slice_size -= slice_off;
413 memcpy(ctx->
cursor_buf, src + 59, 32 * 32 * 4);
static av_always_inline void fic_alpha_blend(uint8_t *dst, uint8_t *src, int size, uint8_t *alpha)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int shift(int a, int b)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static int get_se_golomb(GetBitContext *gb)
read signed exp golomb code.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
static av_cold int init(AVCodecContext *avctx)
#define DECLARE_ALIGNED(n, t, v)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static av_cold int fic_decode_close(AVCodecContext *avctx)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
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_RB32
static const uint8_t fic_header[7]
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
bitstream reader API header.
static double alpha(void *priv, double x, double y)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void fic_idct_put(uint8_t *dst, int stride, int16_t *block)
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. ...
static const uint8_t fic_qmat_lq[64]
const char * name
Name of the codec implementation.
Libavcodec external API header.
static int fic_decode_block(FICContext *ctx, GetBitContext *gb, uint8_t *dst, int stride, int16_t *block)
enum AVPictureType cur_frame_type
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...
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
static av_cold int fic_decode_init(AVCodecContext *avctx)
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
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
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
static unsigned int get_bits1(GetBitContext *s)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
const uint8_t ff_zigzag_direct[64]
FICThreadContext * slice_data
static const uint8_t fic_qmat_hq[64]
static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd)
static int fic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
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)
GLint GLenum GLboolean GLsizei stride
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
common internal api header.
common internal and external API header
int(* execute)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size)
The codec may call this to execute several independent things.
int key_frame
1 -> keyframe, 0-> not
static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y)
static int fic_decode_slice(AVCodecContext *avctx, void *tdata)
This structure stores compressed data.