49 for (i = 0; i < 256; i++) {
63 while (he[last].len == 255 && last)
67 for (i = last; i >= 0; i--) {
68 codes[i] = code >> (32 - he[i].
len);
71 code += 0x80000000u >> (he[i].
len - 1);
75 bits,
sizeof(*bits),
sizeof(*bits),
76 codes,
sizeof(*codes),
sizeof(*codes),
77 syms,
sizeof(*syms),
sizeof(*syms), 0);
83 const uint8_t *src,
int use_pred)
98 for (slice = 0; slice < c->
slices; slice++) {
102 send = (height * (slice + 1) / c->
slices) & cmask;
103 dest = dst + sstart *
stride;
106 for (j = sstart; j < send; j++) {
107 for (i = 0; i < width *
step; i +=
step) {
124 for (slice = 0; slice < c->
slices; slice++) {
126 int slice_data_start, slice_data_end, slice_size;
129 send = (height * (slice + 1) / c->
slices) & cmask;
130 dest = dst + sstart *
stride;
133 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
134 slice_data_end =
AV_RL32(src + slice * 4);
135 slice_size = slice_data_end - slice_data_start;
139 "yet a slice has a length of zero.\n");
148 (slice_data_end - slice_data_start + 3) >> 2);
152 for (j = sstart; j < send; j++) {
153 for (i = 0; i < width *
step; i +=
step) {
156 "Slice decoding ran out of bits\n");
191 for (j = 0; j <
height; j++) {
192 for (i = 0; i < width *
step; i +=
step) {
196 src[i] = r + g - 0x80;
197 src[i + 2] = b + g - 0x80;
209 int slice_start, slice_height;
210 const int cmask = ~rmode;
212 for (slice = 0; slice < slices; slice++) {
213 slice_start = ((slice *
height) / slices) & cmask;
214 slice_height = ((((slice + 1) * height) / slices) & cmask) -
219 bsrc = src + slice_start *
stride;
224 for (i = step; i < width *
step; i +=
step) {
229 if (slice_height == 1)
235 for (i = step; i < width *
step; i +=
step) {
243 for (j = 2; j < slice_height; j++) {
244 for (i = 0; i < width *
step; i +=
step) {
265 int slice_start, slice_height;
266 const int cmask = ~(rmode ? 3 : 1);
267 const int stride2 = stride << 1;
269 for (slice = 0; slice < slices; slice++) {
270 slice_start = ((slice *
height) / slices) & cmask;
271 slice_height = ((((slice + 1) * height) / slices) & cmask) -
277 bsrc = src + slice_start *
stride;
282 for (i = step; i < width *
step; i +=
step) {
286 for (i = 0; i < width *
step; i +=
step) {
287 bsrc[stride + i] +=
A;
288 A = bsrc[stride + i];
291 if (slice_height == 1)
297 for (i = step; i < width *
step; i +=
step) {
298 B = bsrc[i - stride2];
303 for (i = 0; i < width *
step; i +=
step) {
307 A = bsrc[stride + i];
311 for (j = 2; j < slice_height; j++) {
312 for (i = 0; i < width *
step; i +=
step) {
313 B = bsrc[i - stride2];
318 for (i = 0; i < width *
step; i +=
step) {
333 int buf_size = avpkt->
size;
337 int plane_size, max_slice_size = 0, slice_start,
slice_end, slice_size;
351 for (i = 0; i < c->
planes; i++) {
352 plane_start[i] = gb.
buffer;
360 for (j = 0; j < c->
slices; j++) {
361 slice_end = bytestream2_get_le32u(&gb);
362 slice_size = slice_end - slice_start;
363 if (slice_end < 0 || slice_size < 0 ||
369 max_slice_size =
FFMAX(max_slice_size, slice_size);
401 for (i = 0; i < c->
planes; i++) {
404 avctx->
height, plane_start[i],
425 for (i = 0; i < 3; i++) {
446 for (i = 0; i < 3; i++) {
487 "Insufficient extradata size %d, should be at least 16\n",
510 case MKTAG(
'U',
'L',
'R',
'G'):
514 case MKTAG(
'U',
'L',
'R',
'A'):
518 case MKTAG(
'U',
'L',
'Y',
'0'):
523 case MKTAG(
'U',
'L',
'Y',
'2'):
528 case MKTAG(
'U',
'L',
'H',
'0'):
533 case MKTAG(
'U',
'L',
'H',
'2'):
static void restore_median(uint8_t *src, int step, int stride, int width, int height, int slices, int rmode)
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
packed RGB 8:8:8, 24bpp, RGBRGB...
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
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 use_pred)
static av_cold int decode_end(AVCodecContext *avctx)
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 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)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
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)
Multithreading support functions.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static void restore_median_il(uint8_t *src, int step, int stride, int width, int height, int slices, int rmode)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
bitstream reader API header.
int interlaced_frame
The content of the picture is interlaced.
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...
const int ff_ut_rgb_order[4]
static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int decode_init(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
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.
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
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_rgb_planes(uint8_t *src, int step, int stride, int width, int height)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
main external API structure.
static void close(AVCodecParserContext *s)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
enum AVColorSpace colorspace
YUV colorspace type.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
int ff_ut_huff_cmp_len(const void *a, const void *b)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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_FRAME_THREADS
Codec supports frame-level multithreading.
static av_cold int init(AVCodecParserContext *s)
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
#define MKTAG(a, b, c, d)
AVCodec ff_utvideo_decoder
This structure stores compressed data.
void ff_free_vlc(VLC *vlc)