50 for (i = 0; i < 256; i++) {
62 while (he[last].len == 255 && last)
65 if (he[last].len > 32)
69 for (i = last; i >= 0; i--) {
70 codes[i] = code >> (32 - he[i].
len);
73 code += 0x80000000
u >> (he[i].
len - 1);
77 bits,
sizeof(*bits),
sizeof(*bits),
78 codes,
sizeof(*codes),
sizeof(*codes),
79 syms,
sizeof(*syms),
sizeof(*syms), 0);
100 for (slice = 0; slice < c->
slices; slice++) {
104 send = (height * (slice + 1) / c->
slices) & cmask;
105 dest = dst + sstart *
stride;
108 for (j = sstart; j < send; j++) {
109 for (i = 0; i < width * step; i += step) {
112 prev += (unsigned)pix;
126 for (slice = 0; slice < c->
slices; slice++) {
128 int slice_data_start, slice_data_end, slice_size;
131 send = (height * (slice + 1) / c->
slices) & cmask;
132 dest = dst + sstart *
stride;
135 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
136 slice_data_end =
AV_RL32(src + slice * 4);
137 slice_size = slice_data_end - slice_data_start;
141 "yet a slice has a length of zero.\n");
150 (slice_data_end - slice_data_start + 3) >> 2);
154 for (j = sstart; j < send; j++) {
155 for (i = 0; i < width * step; i += step) {
158 "Slice decoding ran out of bits\n");
193 for (j = 0; j <
height; j++) {
194 for (i = 0; i < width * step; i += step) {
198 src[i] = r + g - 0x80;
199 src[i + 2] = b + g - 0x80;
211 int slice_start, slice_height;
212 const int cmask = ~rmode;
214 for (slice = 0; slice < slices; slice++) {
215 slice_start = ((slice *
height) / slices) & cmask;
216 slice_height = ((((slice + 1) * height) / slices) & cmask) -
221 bsrc = src + slice_start *
stride;
226 for (i = step; i < width * step; i += step) {
231 if (slice_height <= 1)
237 for (i = step; i < width * step; i += step) {
245 for (j = 2; j < slice_height; j++) {
246 for (i = 0; i < width * step; i += step) {
267 int slice_start, slice_height;
268 const int cmask = ~(rmode ? 3 : 1);
269 const int stride2 = stride << 1;
271 for (slice = 0; slice < slices; slice++) {
272 slice_start = ((slice *
height) / slices) & cmask;
273 slice_height = ((((slice + 1) * height) / slices) & cmask) -
279 bsrc = src + slice_start *
stride;
284 for (i = step; i < width * step; i += step) {
288 for (i = 0; i < width * step; i += step) {
289 bsrc[stride + i] +=
A;
290 A = bsrc[stride + i];
293 if (slice_height <= 1)
299 for (i = step; i < width * step; i += step) {
300 B = bsrc[i - stride2];
305 for (i = 0; i < width * step; i += step) {
309 A = bsrc[stride + i];
313 for (j = 2; j < slice_height; j++) {
314 for (i = 0; i < width * step; i += step) {
315 B = bsrc[i - stride2];
320 for (i = 0; i < width * step; i += step) {
335 int buf_size = avpkt->
size;
339 int plane_size, max_slice_size = 0, slice_start,
slice_end, slice_size;
349 for (i = 0; i < c->
planes; i++) {
350 plane_start[i] = gb.
buffer;
358 for (j = 0; j < c->
slices; j++) {
359 slice_end = bytestream2_get_le32u(&gb);
360 slice_size = slice_end - slice_start;
361 if (slice_end < 0 || slice_size < 0 ||
367 max_slice_size =
FFMAX(max_slice_size, slice_size);
399 for (i = 0; i < c->
planes; i++) {
402 avctx->
height, plane_start[i],
423 for (i = 0; i < 3; i++) {
444 for (i = 0; i < 3; i++) {
478 int h_shift, v_shift;
486 "Insufficient extradata size %d, should be at least 16\n",
509 case MKTAG(
'U',
'L',
'R',
'G'):
513 case MKTAG(
'U',
'L',
'R',
'A'):
517 case MKTAG(
'U',
'L',
'Y',
'0'):
522 case MKTAG(
'U',
'L',
'Y',
'2'):
527 case MKTAG(
'U',
'L',
'H',
'0'):
532 case MKTAG(
'U',
'L',
'H',
'2'):
544 if ((avctx->
width & ((1<<h_shift)-1)) ||
545 (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.
ptrdiff_t const GLvoid * data
#define AV_LOG_WARNING
Something somehow does not look correct.
packed RGB 8:8:8, 24bpp, RGBRGB...
static av_cold int init(AVCodecContext *avctx)
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
#define avpriv_request_sample(...)
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)
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)
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)
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.
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)
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.
#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)
const char * name
Name of the codec implementation.
Libavcodec external API header.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
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 FFmpeg, 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)
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.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
BYTE int const BYTE int int int height
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.
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
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)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
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)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.