50 for (i = 0; i < 1024; i++) {
62 while (he[last].len == 255 && last)
65 if (he[last].len > 32) {
70 for (i = last; i >= 0; i--) {
71 codes[i] = code >> (32 - he[i].
len);
74 code += 0x80000000
u >> (he[i].
len - 1);
78 bits,
sizeof(*bits),
sizeof(*bits),
79 codes,
sizeof(*codes),
sizeof(*codes),
80 syms,
sizeof(*syms),
sizeof(*syms), 0);
94 for (i = 0; i < 256; i++) {
106 while (he[last].len == 255 && last)
109 if (he[last].len > 32)
113 for (i = last; i >= 0; i--) {
114 codes[i] = code >> (32 - he[i].
len);
117 code += 0x80000000
u >> (he[i].
len - 1);
121 bits,
sizeof(*bits),
sizeof(*bits),
122 codes,
sizeof(*codes),
sizeof(*codes),
123 syms,
sizeof(*syms),
sizeof(*syms), 0);
127 uint16_t *dst,
int step, ptrdiff_t
stride,
132 int i, j, slice, pix, ret;
144 for (slice = 0; slice < c->
slices; slice++) {
148 send = (height * (slice + 1) / c->
slices);
149 dest = dst + sstart *
stride;
152 for (j = sstart; j < send; j++) {
153 for (i = 0; i < width * step; i += step) {
169 for (slice = 0; slice < c->
slices; slice++) {
171 int slice_data_start, slice_data_end, slice_size;
174 send = (height * (slice + 1) / c->
slices);
175 dest = dst + sstart *
stride;
178 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
179 slice_data_end =
AV_RL32(src + slice * 4);
180 slice_size = slice_data_end - slice_data_start;
184 "yet a slice has a length of zero.\n");
193 (slice_data_end - slice_data_start + 3) >> 2);
197 for (j = sstart; j < send; j++) {
198 for (i = 0; i < width * step; i += step) {
201 "Slice decoding ran out of bits\n");
236 int i, j, slice, pix;
249 for (slice = 0; slice < c->
slices; slice++) {
253 send = (height * (slice + 1) / c->
slices) & cmask;
254 dest = dst + sstart *
stride;
257 for (j = sstart; j < send; j++) {
258 for (i = 0; i < width * step; i += step) {
275 for (slice = 0; slice < c->
slices; slice++) {
277 int slice_data_start, slice_data_end, slice_size;
280 send = (height * (slice + 1) / c->
slices) & cmask;
281 dest = dst + sstart *
stride;
284 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
285 slice_data_end =
AV_RL32(src + slice * 4);
286 slice_size = slice_data_end - slice_data_start;
290 "yet a slice has a length of zero.\n");
299 (slice_data_end - slice_data_start + 3) >> 2);
303 for (j = sstart; j < send; j++) {
304 for (i = 0; i < width * step; i += step) {
307 "Slice decoding ran out of bits\n");
342 for (j = 0; j <
height; j++) {
343 for (i = 0; i < width * step; i += step) {
347 src[i] = r + g - 0x80;
348 src[i + 2] = b + g - 0x80;
356 uint16_t *src_r = (uint16_t *)frame->
data[2];
357 uint16_t *src_g = (uint16_t *)frame->
data[0];
358 uint16_t *src_b = (uint16_t *)frame->
data[1];
363 for (i = 0; i <
width; i++) {
367 src_r[i] = (r +
g - 0x200) & 0x3FF;
368 src_b[i] = (
b +
g - 0x200) & 0x3FF;
386 int slice_start, slice_height;
387 const int cmask = ~rmode;
389 for (slice = 0; slice < slices; slice++) {
390 slice_start = ((slice *
height) / slices) & cmask;
391 slice_height = ((((slice + 1) * height) / slices) & cmask) -
396 bsrc = src + slice_start *
stride;
402 if (slice_height <= 1)
408 for (i = 1; i <
width; i++) {
416 for (j = 2; j < slice_height; j++) {
418 bsrc, width, &A, &B);
434 int slice_start, slice_height;
435 const int cmask = ~(rmode ? 3 : 1);
436 const ptrdiff_t stride2 = stride << 1;
438 for (slice = 0; slice < slices; slice++) {
439 slice_start = ((slice *
height) / slices) & cmask;
440 slice_height = ((((slice + 1) * height) / slices) & cmask) -
446 bsrc = src + slice_start *
stride;
453 if (slice_height <= 1)
459 for (i = 1; i <
width; i++) {
460 B = bsrc[i - stride2];
466 bsrc + stride, width, &A, &B);
469 for (j = 2; j < slice_height; j++) {
471 bsrc, width, &A, &B);
473 bsrc + stride, width, &A, &B);
485 int slice_start, slice_height;
486 const int cmask = ~rmode;
488 for (slice = 0; slice < slices; slice++) {
489 slice_start = ((slice *
height) / slices) & cmask;
490 slice_height = ((((slice + 1) * height) / slices) & cmask) -
495 bsrc = src + slice_start *
stride;
500 for (i = step; i < width * step; i += step) {
505 if (slice_height <= 1)
511 for (i = step; i < width * step; i += step) {
519 for (j = 2; j < slice_height; j++) {
520 for (i = 0; i < width * step; i += step) {
541 int slice_start, slice_height;
542 const int cmask = ~(rmode ? 3 : 1);
543 const ptrdiff_t stride2 = stride << 1;
545 for (slice = 0; slice < slices; slice++) {
546 slice_start = ((slice *
height) / slices) & cmask;
547 slice_height = ((((slice + 1) * height) / slices) & cmask) -
553 bsrc = src + slice_start *
stride;
558 for (i = step; i < width * step; i += step) {
562 for (i = 0; i < width * step; i += step) {
563 bsrc[stride + i] +=
A;
564 A = bsrc[stride + i];
567 if (slice_height <= 1)
573 for (i = step; i < width * step; i += step) {
574 B = bsrc[i - stride2];
579 for (i = 0; i < width * step; i += step) {
583 A = bsrc[stride + i];
587 for (j = 2; j < slice_height; j++) {
588 for (i = 0; i < width * step; i += step) {
589 B = bsrc[i - stride2];
594 for (i = 0; i < width * step; i += step) {
609 int buf_size = avpkt->
size;
613 int plane_size, max_slice_size = 0, slice_start,
slice_end, slice_size;
630 for (i = 0; i < c->
planes; i++) {
631 plane_start[i] = gb.
buffer;
638 for (j = 0; j < c->
slices; j++) {
639 slice_end = bytestream2_get_le32u(&gb);
640 if (slice_end < 0 || slice_end < slice_start ||
645 slice_size = slice_end - slice_start;
647 max_slice_size =
FFMAX(max_slice_size, slice_size);
655 for (i = 0; i < c->
planes; i++) {
656 plane_start[i] = gb.
buffer;
664 for (j = 0; j < c->
slices; j++) {
665 slice_end = bytestream2_get_le32u(&gb);
666 if (slice_end < 0 || slice_end < slice_start ||
671 slice_size = slice_end - slice_start;
673 max_slice_size =
FFMAX(max_slice_size, slice_size);
706 for (i = 0; i < c->
planes; i++) {
709 avctx->
height, plane_start[i],
731 for (i = 0; i < c->
planes; i++) {
734 avctx->
height, plane_start[i],
735 plane_start[i + 1] - 1024,
743 for (i = 0; i < 3; i++) {
764 for (i = 0; i < 3; i++) {
784 for (i = 0; i < 3; i++) {
804 for (i = 0; i < 3; i++) {
859 "Insufficient extradata size %d, should be at least 16\n",
867 case MKTAG(
'U',
'L',
'R',
'G'):
871 case MKTAG(
'U',
'L',
'R',
'A'):
875 case MKTAG(
'U',
'L',
'Y',
'0'):
880 case MKTAG(
'U',
'L',
'Y',
'2'):
885 case MKTAG(
'U',
'L',
'Y',
'4'):
890 case MKTAG(
'U',
'Q',
'Y',
'2'):
894 case MKTAG(
'U',
'Q',
'R',
'G'):
898 case MKTAG(
'U',
'Q',
'R',
'A'):
902 case MKTAG(
'U',
'L',
'H',
'0'):
907 case MKTAG(
'U',
'L',
'H',
'2'):
912 case MKTAG(
'U',
'L',
'H',
'4'):
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
static void restore_median_planar_il(UtvideoContext *c, uint8_t *src, ptrdiff_t stride, int width, int height, int slices, int rmode)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
int ff_ut10_huff_cmp_len(const void *a, const void *b)
ptrdiff_t const GLvoid * data
#define AV_PIX_FMT_GBRAP10
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#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 ...
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)
#define AV_PIX_FMT_GBRP10
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)
static int decode_plane(UtvideoContext *c, int plane_no, uint8_t *dst, int step, ptrdiff_t stride, int width, int height, const uint8_t *src, int use_pred)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Multithreading support functions.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
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)
#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.
#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)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
static void restore_median_planar(UtvideoContext *c, uint8_t *src, ptrdiff_t stride, int width, int height, int slices, int rmode)
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.
static void restore_rgb_planes10(AVFrame *frame, int width, int height)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Libavcodec external API header.
static void restore_rgb_planes(uint8_t *src, int step, ptrdiff_t stride, int width, int height)
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').
void ff_llviddsp_init(LLVidDSPContext *c)
enum AVColorSpace colorspace
YUV colorspace type.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static int build_huff10(const uint8_t *src, VLC *vlc, int *fsym)
#define AV_PIX_FMT_YUV422P10
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.
GLint GLenum GLboolean GLsizei stride
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
#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)
int(* add_left_pred)(uint8_t *dst, const uint8_t *src, ptrdiff_t w, int left)
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
static void restore_median_packed_il(uint8_t *src, int step, ptrdiff_t stride, int width, int height, int slices, int rmode)
static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
static void restore_median_packed(uint8_t *src, int step, ptrdiff_t stride, int width, int height, int slices, int rmode)
#define MKTAG(a, b, c, d)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
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.
void(* add_median_pred)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, ptrdiff_t w, int *left, int *left_top)
static int decode_plane10(UtvideoContext *c, int plane_no, uint16_t *dst, int step, ptrdiff_t stride, int width, int height, const uint8_t *src, const uint8_t *huff, int use_pred)