50 for (i = 0; i < 256; i++) {
64 while (he[last].len == 255 && last)
68 for (i = last; i >= 0; i--) {
69 codes[i] = code >> (32 - he[i].
len);
72 code += 0x80000000u >> (he[i].
len - 1);
76 bits,
sizeof(*bits),
sizeof(*bits),
77 codes,
sizeof(*codes),
sizeof(*codes),
78 syms,
sizeof(*syms),
sizeof(*syms), 0);
84 const uint8_t *src,
int use_pred)
99 for (slice = 0; slice < c->
slices; slice++) {
103 send = (height * (slice + 1) / c->
slices) & cmask;
104 dest = dst + sstart *
stride;
107 for (j = sstart; j < send; j++) {
108 for (i = 0; i < width *
step; i +=
step) {
125 for (slice = 0; slice < c->
slices; slice++) {
127 int slice_data_start, slice_data_end, slice_size;
130 send = (height * (slice + 1) / c->
slices) & cmask;
131 dest = dst + sstart *
stride;
134 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
135 slice_data_end =
AV_RL32(src + slice * 4);
136 slice_size = slice_data_end - slice_data_start;
140 "yet a slice has a length of zero.\n");
149 (slice_data_end - slice_data_start + 3) >> 2);
153 for (j = sstart; j < send; j++) {
154 for (i = 0; i < width *
step; i +=
step) {
157 "Slice decoding ran out of bits\n");
192 for (j = 0; j <
height; j++) {
193 for (i = 0; i < width *
step; i +=
step) {
197 src[i] = r + g - 0x80;
198 src[i + 2] = b + g - 0x80;
210 int slice_start, slice_height;
211 const int cmask = ~rmode;
213 for (slice = 0; slice < slices; slice++) {
214 slice_start = ((slice *
height) / slices) & cmask;
215 slice_height = ((((slice + 1) * height) / slices) & cmask) -
220 bsrc = src + slice_start *
stride;
225 for (i = step; i < width *
step; i +=
step) {
230 if (slice_height == 1)
236 for (i = step; i < width *
step; i +=
step) {
244 for (j = 2; j < slice_height; j++) {
245 for (i = 0; i < width *
step; i +=
step) {
266 int slice_start, slice_height;
267 const int cmask = ~(rmode ? 3 : 1);
268 const int stride2 = stride << 1;
270 for (slice = 0; slice < slices; slice++) {
271 slice_start = ((slice *
height) / slices) & cmask;
272 slice_height = ((((slice + 1) * height) / slices) & cmask) -
278 bsrc = src + slice_start *
stride;
283 for (i = step; i < width *
step; i +=
step) {
287 for (i = 0; i < width *
step; i +=
step) {
288 bsrc[stride + i] +=
A;
289 A = bsrc[stride + i];
292 if (slice_height == 1)
298 for (i = step; i < width *
step; i +=
step) {
299 B = bsrc[i - stride2];
304 for (i = 0; i < width *
step; i +=
step) {
308 A = bsrc[stride + i];
312 for (j = 2; j < slice_height; j++) {
313 for (i = 0; i < width *
step; i +=
step) {
314 B = bsrc[i - stride2];
319 for (i = 0; i < width *
step; i +=
step) {
334 int buf_size = avpkt->
size;
338 int plane_size, max_slice_size = 0, slice_start,
slice_end, slice_size;
352 for (i = 0; i < c->
planes; i++) {
353 plane_start[i] = gb.
buffer;
361 for (j = 0; j < c->
slices; j++) {
362 slice_end = bytestream2_get_le32u(&gb);
363 slice_size = slice_end - slice_start;
364 if (slice_end < 0 || slice_size < 0 ||
370 max_slice_size =
FFMAX(max_slice_size, slice_size);
402 for (i = 0; i < c->
planes; i++) {
405 avctx->
height, plane_start[i],
426 for (i = 0; i < 3; i++) {
447 for (i = 0; i < 3; i++) {
481 int h_shift, v_shift;
489 "Insufficient extradata size %d, should be at least 16\n",
512 case MKTAG(
'U',
'L',
'R',
'G'):
516 case MKTAG(
'U',
'L',
'R',
'A'):
520 case MKTAG(
'U',
'L',
'Y',
'0'):
525 case MKTAG(
'U',
'L',
'Y',
'2'):
530 case MKTAG(
'U',
'L',
'H',
'0'):
535 case MKTAG(
'U',
'L',
'H',
'2'):
547 if ((avctx->
width & ((1<<h_shift)-1)) ||
548 (avctx->
height & ((1<<v_shift)-1))) {
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.
FF_ENABLE_DEPRECATION_WARNINGS int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
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)