78 return (aa->
len - bb->len) * 256 + aa->
sym - bb->sym;
90 for (i = 0; i < 256; i++) {
97 for (i = 255; i >= 0; i--) {
98 codes[i] = code >> (32 - he[i].
len);
101 code += 0x80000000
u >> (he[i].
len - 1);
106 bits,
sizeof(*bits),
sizeof(*bits),
107 codes,
sizeof(*codes),
sizeof(*codes),
108 syms,
sizeof(*syms),
sizeof(*syms), 0);
121 for (i = 0; i < s->
planes; i++) {
137 for (k = 0; k <
height; k++) {
138 for (x = 0; x <
width; x++) {
144 for (k = 0; k <
height; k++) {
145 for (x = 0; x <
width; x++) {
168 for (k = 1 + interlaced; k <
height; k++) {
173 int left, lefttop, top;
184 for (k = 1 + interlaced; k <
height; k++) {
185 top = dst[-fake_stride];
188 for (x = 1; x <
width; x++) {
189 top = dst[x - fake_stride];
190 lefttop = dst[x - (fake_stride + 1)];
191 left += top - lefttop + dst[x];
196 }
else if (pred ==
MEDIAN) {
200 lefttop = left = dst[0];
204 lefttop = left = dst[0];
208 for (k = 1 + interlaced; k <
height; k++) {
210 lefttop = left = dst[0];
225 for (i = 0; i <
height; i++) {
238 void *
data,
int *got_frame,
241 uint32_t first_offset,
offset, next_offset, header_size, slice_width;
251 if (bytestream2_get_le32(&gb) !=
MKTAG(
'M',
'A',
'G',
'Y'))
254 header_size = bytestream2_get_le32(&gb);
255 if (header_size < 32 || header_size >= avpkt->
size)
258 version = bytestream2_get_byte(&gb);
268 format = bytestream2_get_byte(&gb);
309 s->
interlaced = !!(bytestream2_get_byte(&gb) & 2);
312 width = bytestream2_get_le32(&gb);
313 height = bytestream2_get_le32(&gb);
317 slice_width = bytestream2_get_le32(&gb);
336 for (i = 0; i < s->
planes; i++) {
341 offset = bytestream2_get_le32(&gb);
342 if (offset >= avpkt->
size - header_size)
350 next_offset = bytestream2_get_le32(&gb);
352 offset = next_offset;
354 if (offset >= avpkt->
size - header_size)
362 if (bytestream2_get_byte(&gb) != s->
planes)
374 memset(s->
len, 0,
sizeof(s->
len));
381 for (k = 0; k <
L; k++) {
383 s->
len[i][j + k] = x;
397 }
else if (j > 256) {
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static int ff_magy_huff_cmp_len(const void *a, const void *b)
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 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)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
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 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.
static int decode_slice(AVCodecContext *avctx, void *tdata, int j, int threadnr)
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.
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_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 build_huff(VLC *vlc, uint8_t *len)
static const char * format
AVCodec ff_magicyuv_decoder
static av_cold int decode_init(AVCodecContext *avctx)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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)
common internal api header.
planar GBRA 4:4:4:4 32bpp
static av_cold int decode_end(AVCodecContext *avctx)
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)