62 1, 2, 2, 2, 3, 3, 3, 4,
63 2, 2, 2, 3, 3, 3, 4, 4,
64 2, 2, 3, 3, 3, 4, 4, 4,
65 2, 2, 3, 3, 3, 4, 4, 5,
66 2, 3, 3, 3, 4, 4, 5, 6,
67 3, 3, 3, 4, 4, 5, 6, 7,
68 3, 3, 3, 4, 4, 5, 7, 7,
69 3, 3, 4, 4, 5, 7, 7, 7,
73 1, 5, 6, 7, 8, 9, 9, 11,
74 5, 5, 7, 8, 9, 9, 11, 12,
75 6, 7, 8, 9, 9, 11, 11, 12,
76 7, 7, 8, 9, 9, 11, 12, 13,
77 7, 8, 9, 9, 10, 11, 13, 16,
78 8, 9, 9, 10, 11, 13, 16, 19,
79 8, 9, 9, 11, 12, 15, 18, 23,
80 9, 9, 11, 12, 15, 18, 23, 27
85 #define FIC_HEADER_SIZE 27 86 #define CURSOR_OFFSET 59 90 const unsigned t0 = 27246 * blk[3 *
step] + 18405 * blk[5 *
step];
91 const unsigned t1 = 27246 * blk[5 *
step] - 18405 * blk[3 *
step];
92 const unsigned t2 = 6393 * blk[7 *
step] + 32139 * blk[1 *
step];
93 const unsigned t3 = 6393 * blk[1 *
step] - 32139 * blk[7 *
step];
94 const unsigned t4 = 5793
U * ((
int)(t2 + t0 + 0x800) >> 12);
95 const unsigned t5 = 5793
U * ((
int)(t3 + t1 + 0x800) >> 12);
96 const unsigned t6 = t2 -
t0;
97 const unsigned t7 = t3 -
t1;
98 const unsigned t8 = 17734 * blk[2 *
step] - 42813 * blk[6 *
step];
99 const unsigned t9 = 17734 * blk[6 *
step] + 42814 * blk[2 *
step];
100 const unsigned tA = (blk[0 *
step] - blk[4 *
step]) * 32768 + rnd;
101 const unsigned tB = (blk[0 *
step] + blk[4 *
step]) * 32768 + rnd;
107 blk[5 *
step] = (
int)(-(t6 - t7) - t8 + tA) >> shift;
108 blk[6 *
step] = (
int)(-(t6 + t7) + t8 + tA) >> shift;
118 fic_idct(ptr++, 8, 13, (1 << 12) + (1 << 17));
119 for (i = 1; i < 8; i++) {
125 for (i = 0; i < 8; i++) {
131 for (j = 0; j < 8; j++) {
132 for (i = 0; i < 8; i++)
152 memset(block, 0,
sizeof(*block) * 64);
158 for (i = 0; i < num_coeff; i++) {
160 if (v < -2048 || v > 2048)
163 ctx->
qmat[ff_zigzag_direct[
i]];
186 for (p = 0; p < 3; p++) {
190 for (y = 0; y < (slice_h >> !!p); y += 8) {
211 for (i = 0; i <
size; i++)
212 dst[i] += ((src[i] - dst[i]) * alpha[i]) >> 8;
225 for (i = 0; i < 1024; i++) {
226 planes[0][
i] = (( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16;
227 planes[1][
i] = ((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128;
228 planes[2][
i] = ((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128;
229 planes[3][
i] = ptr[3];
235 for (i = 0; i < 32; i += 2)
236 for (j = 0; j < 32; j += 2)
237 for (p = 0; p < 3; p++)
238 chroma[p][16 * (i / 2) + j / 2] = (planes[p + 1][32 * i + j ] +
239 planes[p + 1][32 * i + j + 1] +
240 planes[p + 1][32 * (i + 1) + j ] +
241 planes[p + 1][32 * (i + 1) + j + 1]) / 4;
244 for (i = 0; i < 3; i++)
247 (cur_x >> !!i) + !!
i;
250 for (i = 0; i <
FFMIN(32, avctx->
height - cur_y) - 1; i += 2) {
252 int csize = lsize / 2;
255 planes[0] + i * 32, lsize, planes[3] + i * 32);
257 planes[0] + (i + 1) * 32, lsize, planes[3] + (i + 1) * 32);
259 chroma[0] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
261 chroma[1] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
317 "Packet is too small to contain cursor (%d vs %d bytes).\n",
325 if (!skip_cursor && tsize < 32) {
327 "Cursor data too small. Skipping cursor.\n");
334 if (!skip_cursor && (cur_x > avctx->
width || cur_y > avctx->
height)) {
336 "Invalid cursor position: (%d,%d). Skipping cursor.\n",
341 if (!skip_cursor && (
AV_RL16(src + 37) != 32 ||
AV_RL16(src + 39) != 32)) {
343 "Invalid cursor size. Skipping cursor.\n");
360 if (msize <= ctx->aligned_width/8 * (ctx->
aligned_height/8) / 8) {
374 for (slice = 0; slice < nslices; slice++) {
375 unsigned slice_off =
AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4);
384 if (slice == nslices - 1) {
388 slice_size =
AV_RB32(src + tsize + FIC_HEADER_SIZE + slice * 4 + 4);
389 if (slice_size < slice_off)
393 if (slice_size < slice_off || slice_size > msize)
396 slice_size -= slice_off;
410 for (slice = 0; slice < nslices; slice++) {
496 .priv_class = &fic_decoder_class,
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.
#define LIBAVUTIL_VERSION_INT
static av_cold int init(AVCodecContext *avctx)
const char * av_default_item_name(void *ptr)
Return the context name.
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 const struct @322 planes[]
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static av_cold int fic_decode_close(AVCodecContext *avctx)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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 DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
bitstream reader API header.
static int get_bits_left(GetBitContext *gb)
#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. ...
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 uint8_t fic_qmat_lq[64]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * name
Name of the codec implementation.
static const AVOption options[]
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
enum AVPictureType pict_type
Picture type of the frame.
static const AVClass fic_decoder_class
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.
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Libavcodec external API header.
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.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static const int16_t alpha[]
#define AV_OPT_FLAG_VIDEO_PARAM
main external API structure.
static unsigned int get_bits1(GetBitContext *s)
Describe the class of an AVClass context structure.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
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.
GLint GLenum GLboolean GLsizei stride
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
common internal and external API header
static int fic_decode_block(FICContext *ctx, GetBitContext *gb, uint8_t *dst, int stride, int16_t *block, int *is_p)
int key_frame
1 -> keyframe, 0-> not
static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y)
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 fic_decode_slice(AVCodecContext *avctx, void *tdata)
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.
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators...
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step