72 return (aa->
len - bb->len) * 256 + aa->
sym - bb->sym;
84 for (i = 0; i < 256; i++) {
91 for (i = 255; i >= 0; i--) {
92 codes[i] = code >> (32 - he[i].
len);
95 code += 0x80000000
u >> (he[i].
len - 1);
100 bits,
sizeof(*bits),
sizeof(*bits),
101 codes,
sizeof(*codes),
sizeof(*codes),
102 syms,
sizeof(*syms),
sizeof(*syms), 0);
115 for (i = 0; i < s->
planes; i++) {
116 int left, lefttop, top;
134 for (k = 0; k <
height; k++) {
135 for (x = 0; x <
width; x++)
141 for (k = 0; k <
height; k++) {
142 for (x = 0; x <
width; x++) {
166 for (k = 1 + interlaced; k <
height; k++) {
181 for (k = 1 + interlaced; k <
height; k++) {
182 top = dst[-fake_stride];
185 for (x = 1; x <
width; x++) {
186 top = dst[x - fake_stride];
187 lefttop = dst[x - (fake_stride + 1)];
188 left += top - lefttop + dst[x];
196 lefttop = left = dst[0];
200 lefttop = left = dst[0];
204 for (k = 1 + interlaced; k <
height; k++) {
206 dst, width, &left, &lefttop);
207 lefttop = left = dst[0];
223 for (i = 0; i <
height; i++) {
243 uint32_t first_offset,
offset, next_offset, header_size, slice_width;
248 if (bytestream2_get_le32(&gbyte) !=
MKTAG(
'M',
'A',
'G',
'Y'))
251 header_size = bytestream2_get_le32(&gbyte);
252 if (header_size < 32 || header_size >= avpkt->
size) {
254 "header or packet too small %"PRIu32
"\n", header_size);
258 version = bytestream2_get_byte(&gbyte);
270 format = bytestream2_get_byte(&gbyte);
308 s->
interlaced = !!(bytestream2_get_byte(&gbyte) & 2);
311 width = bytestream2_get_le32(&gbyte);
312 height = bytestream2_get_le32(&gbyte);
317 slice_width = bytestream2_get_le32(&gbyte);
334 "invalid number of slices: %d\n", s->
nb_slices);
338 for (i = 0; i < s->
planes; i++) {
343 offset = bytestream2_get_le32(&gbyte);
344 if (offset >= avpkt->
size - header_size)
353 next_offset = bytestream2_get_le32(&gbyte);
354 if (next_offset <= offset || next_offset >= avpkt->
size - header_size)
358 offset = next_offset;
365 if (bytestream2_get_byte(&gbyte) != s->
planes)
378 memset(s->
len, 0,
sizeof(s->
len));
385 for (k = 0; k < l; k++)
387 s->
len[i][j + k] = x;
400 }
else if (j > 256) {
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
int coded_width
Bitstream width / height, may be different from width/height e.g.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int init_thread_copy(AVCodecContext *avctx)
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static av_cold int init(AVCodecContext *avctx)
int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags)
av_cold void ff_huffyuvdsp_init(HuffYUVDSPContext *c)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
unsigned int slices_size[4]
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Multithreading support functions.
bitstream reader API header.
void(* add_hfyu_median_pred)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, intptr_t w, int *left, int *left_top)
static int magy_decode_slice(AVCodecContext *avctx, void *tdata, int j, int threadnr)
static int huff_cmp_len(const void *a, const void *b)
static int get_bits_left(GetBitContext *gb)
void(* add_bytes)(uint8_t *dst, uint8_t *src, intptr_t w)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
static const uint8_t offset[127][2]
int(* add_hfyu_left_pred)(uint8_t *dst, const uint8_t *src, intptr_t w, int left)
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
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 av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
#define FF_ARRAY_ELEMS(a)
static const float pred[4]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
static av_cold int magy_decode_init(AVCodecContext *avctx)
static av_always_inline int bytestream2_tell(GetByteContext *g)
Libavcodec external API header.
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.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
main external API structure.
static int magy_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const char * format
AVCodec ff_magicyuv_decoder
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_cold int magy_decode_end(AVCodecContext *avctx)
GLint GLenum GLboolean GLsizei stride
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
planar GBRA 4:4:4:4 32bpp
static int huff_build(VLC *vlc, uint8_t *len)
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
#define FFSWAP(type, a, b)
#define MKTAG(a, b, c, d)
This structure stores compressed data.
void ff_free_vlc(VLC *vlc)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_QSORT(p, num, type, cmp)
Quicksort This sort is fast, and fully inplace but not stable and it is possible to construct input t...
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
#define AV_CEIL_RSHIFT(a, b)