67 return (aa->
len - bb->len)*256 + aa->
sym - bb->sym;
81 for (i = 0; i < 256; i++) {
85 qsort(he, 256,
sizeof(*he),
huff_cmp);
95 while (he[last].len == 255 && last)
99 for (i = last; i >= 0; i--) {
100 codes[i] = code >> (32 - he[i].
len);
103 code += 0x80000000u >> (he[i].
len - 1);
107 bits,
sizeof(*bits),
sizeof(*bits),
108 codes,
sizeof(*codes),
sizeof(*codes),
109 syms,
sizeof(*syms),
sizeof(*syms), 0);
115 const uint8_t *src,
int src_size,
int use_pred)
117 int i, j, slice, pix;
130 for (slice = 0; slice < c->
slices; slice++) {
134 send = (height * (slice + 1) / c->
slices) & cmask;
135 dest = dst + sstart *
stride;
138 for (j = sstart; j < send; j++) {
139 for (i = 0; i < width *
step; i +=
step) {
157 for (slice = 0; slice < c->
slices; slice++) {
159 int slice_data_start, slice_data_end, slice_size;
162 send = (height * (slice + 1) / c->
slices) & cmask;
163 dest = dst + sstart *
stride;
166 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
167 slice_data_end =
AV_RL32(src + slice * 4);
168 slice_size = slice_data_end - slice_data_start;
171 for (j = sstart; j < send; j++) {
172 for (i = 0; i < width *
step; i +=
step)
182 (slice_data_end - slice_data_start + 3) >> 2);
186 for (j = sstart; j < send; j++) {
187 for (i = 0; i < width *
step; i +=
step) {
225 for (j = 0; j <
height; j++) {
226 for (i = 0; i < width *
step; i +=
step) {
230 src[i] = r + g - 0x80;
231 src[i + 2] = b + g - 0x80;
243 int slice_start, slice_height;
244 const int cmask = ~rmode;
246 for (slice = 0; slice < slices; slice++) {
247 slice_start = ((slice *
height) / slices) & cmask;
248 slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start;
252 bsrc = src + slice_start *
stride;
257 for (i = step; i < width *
step; i +=
step) {
262 if (slice_height == 1)
268 for (i = step; i < width *
step; i +=
step) {
270 bsrc[i] +=
mid_pred(A, B, (uint8_t)(A + B - C));
276 for (j = 2; j < slice_height; j++) {
277 for (i = 0; i < width *
step; i +=
step) {
279 bsrc[i] +=
mid_pred(A, B, (uint8_t)(A + B - C));
298 int slice_start, slice_height;
299 const int cmask = ~(rmode ? 3 : 1);
300 const int stride2 = stride << 1;
302 for (slice = 0; slice < slices; slice++) {
303 slice_start = ((slice *
height) / slices) & cmask;
304 slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start;
309 bsrc = src + slice_start *
stride;
314 for (i = step; i < width *
step; i +=
step) {
318 for (i = 0; i < width *
step; i +=
step) {
319 bsrc[stride + i] +=
A;
320 A = bsrc[stride + i];
323 if (slice_height == 1)
329 for (i = step; i < width *
step; i +=
step) {
330 B = bsrc[i - stride2];
331 bsrc[i] +=
mid_pred(A, B, (uint8_t)(A + B - C));
335 for (i = 0; i < width *
step; i +=
step) {
337 bsrc[stride + i] +=
mid_pred(A, B, (uint8_t)(A + B - C));
339 A = bsrc[stride + i];
343 for (j = 2; j < slice_height; j++) {
344 for (i = 0; i < width *
step; i +=
step) {
345 B = bsrc[i - stride2];
346 bsrc[i] +=
mid_pred(A, B, (uint8_t)(A + B - C));
350 for (i = 0; i < width *
step; i +=
step) {
363 const uint8_t *buf = avpkt->
data;
364 int buf_size = avpkt->
size;
367 const uint8_t *plane_start[5];
368 int plane_size, max_slice_size = 0, slice_start,
slice_end, slice_size;
386 for (i = 0; i < c->
planes; i++) {
387 plane_start[i] = gb.
buffer;
395 for (j = 0; j < c->
slices; j++) {
396 slice_end = bytestream2_get_le32u(&gb);
397 slice_size = slice_end - slice_start;
398 if (slice_end <= 0 || slice_size <= 0 ||
404 max_slice_size =
FFMAX(max_slice_size, slice_size);
435 for (i = 0; i < c->
planes; i++) {
438 plane_start[i], plane_start[i + 1] - plane_start[i],
451 for (i = 0; i < 3; i++) {
454 plane_start[i], plane_start[i + 1] - plane_start[i],
473 for (i = 0; i < 3; i++) {
476 plane_start[i], plane_start[i + 1] - plane_start[i],
511 av_log(avctx,
AV_LOG_ERROR,
"Insufficient extradata size %d, should be at least 16\n",
533 case MKTAG(
'U',
'L',
'R',
'G'):
537 case MKTAG(
'U',
'L',
'R',
'A'):
541 case MKTAG(
'U',
'L',
'Y',
'0'):
545 case MKTAG(
'U',
'L',
'Y',
'2'):
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define FF_BUFFER_HINTS_VALID
AV_WL32 AV_WL24 AV_WL16 AV_RB32
int buffer_hints
codec suggestion on buffer type if != 0
#define CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define AV_LOG_WARNING
Something somehow does not look correct.
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
int ff_init_vlc_sparse(VLC *vlc, 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)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
AVCodec ff_utvideo_decoder
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static int decode_plane(UtvideoContext *c, int plane_no, uint8_t *dst, int step, int stride, int width, int height, const uint8_t *src, int src_size, int use_pred)
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
bitstream reader API header.
av_cold void dsputil_init(DSPContext *c, AVCodecContext *avctx)
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static int get_bits_left(GetBitContext *gb)
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
Multithreading support functions.
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.
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
static av_cold int decode_end(AVCodecContext *avctx)
#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.
int width
picture width / height.
struct AVFrame AVFrame
Audio Video Frame.
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
static void restore_median(uint8_t *src, int step, int stride, int width, int height, int slices, int rmode)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static void restore_median_il(uint8_t *src, int step, int stride, int width, int height, int slices, int rmode)
struct UtvideoContext UtvideoContext
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height)
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static int huff_cmp(const void *a, const void *b)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
packed RGB 8:8:8, 24bpp, RGBRGB...
VLC_TYPE(* table)[2]
code, bits
static const int rgb_order[4]
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around get_buffer() for frame-multithreaded codecs.
#define MKTAG(a, b, c, d)
void ff_free_vlc(VLC *vlc)
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
static av_cold int decode_init(AVCodecContext *avctx)
struct HuffEntry HuffEntry