49 for (i = 0; i < 1024; i++) {
61 while (he[last].len == 255 && last)
64 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);
93 for (i = 0; i < 256; i++) {
105 while (he[last].len == 255 && last)
108 if (he[last].len > 32)
112 for (i = last; i >= 0; i--) {
113 codes[i] = code >> (32 - he[i].
len);
116 code += 0x80000000
u >> (he[i].
len - 1);
120 bits,
sizeof(*bits),
sizeof(*bits),
121 codes,
sizeof(*codes),
sizeof(*codes),
122 syms,
sizeof(*syms),
sizeof(*syms), 0);
126 uint16_t *dst,
int step,
int stride,
131 int i, j, slice, pix, ret;
143 for (slice = 0; slice < c->
slices; slice++) {
147 send = (height * (slice + 1) / c->
slices);
148 dest = dst + sstart *
stride;
151 for (j = sstart; j < send; j++) {
152 for (i = 0; i < width * step; i += step) {
168 for (slice = 0; slice < c->
slices; slice++) {
170 int slice_data_start, slice_data_end, slice_size;
173 send = (height * (slice + 1) / c->
slices);
174 dest = dst + sstart *
stride;
177 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
178 slice_data_end =
AV_RL32(src + slice * 4);
179 slice_size = slice_data_end - slice_data_start;
183 "yet a slice has a length of zero.\n");
192 (slice_data_end - slice_data_start + 3) >> 2);
196 for (j = sstart; j < send; j++) {
197 for (i = 0; i < width * step; i += step) {
200 "Slice decoding ran out of bits\n");
235 int i, j, slice, pix;
248 for (slice = 0; slice < c->
slices; slice++) {
252 send = (height * (slice + 1) / c->
slices) & cmask;
253 dest = dst + sstart *
stride;
256 for (j = sstart; j < send; j++) {
257 for (i = 0; i < width * step; i += step) {
274 for (slice = 0; slice < c->
slices; slice++) {
276 int slice_data_start, slice_data_end, slice_size;
279 send = (height * (slice + 1) / c->
slices) & cmask;
280 dest = dst + sstart *
stride;
283 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
284 slice_data_end =
AV_RL32(src + slice * 4);
285 slice_size = slice_data_end - slice_data_start;
289 "yet a slice has a length of zero.\n");
298 (slice_data_end - slice_data_start + 3) >> 2);
302 for (j = sstart; j < send; j++) {
303 for (i = 0; i < width * step; i += step) {
306 "Slice decoding ran out of bits\n");
341 for (j = 0; j <
height; j++) {
342 for (i = 0; i < width * step; i += step) {
346 src[i] = r + g - 0x80;
347 src[i + 2] = b + g - 0x80;
355 uint16_t *src_r = (uint16_t *)frame->
data[2];
356 uint16_t *src_g = (uint16_t *)frame->
data[0];
357 uint16_t *src_b = (uint16_t *)frame->
data[1];
362 for (i = 0; i <
width; i++) {
366 src_r[i] = (r +
g - 0x200) & 0x3FF;
367 src_b[i] = (
b +
g - 0x200) & 0x3FF;
381 int slice_start, slice_height;
382 const int cmask = ~rmode;
384 for (slice = 0; slice < slices; slice++) {
385 slice_start = ((slice *
height) / slices) & cmask;
386 slice_height = ((((slice + 1) * height) / slices) & cmask) -
391 bsrc = src + slice_start *
stride;
396 for (i = step; i < width * step; i += step) {
401 if (slice_height <= 1)
407 for (i = step; i < width * step; i += step) {
415 for (j = 2; j < slice_height; j++) {
416 for (i = 0; i < width * step; i += step) {
437 int slice_start, slice_height;
438 const int cmask = ~(rmode ? 3 : 1);
439 const int stride2 = stride << 1;
441 for (slice = 0; slice < slices; slice++) {
442 slice_start = ((slice *
height) / slices) & cmask;
443 slice_height = ((((slice + 1) * height) / slices) & cmask) -
449 bsrc = src + slice_start *
stride;
454 for (i = step; i < width * step; i += step) {
458 for (i = 0; i < width * step; i += step) {
459 bsrc[stride + i] +=
A;
460 A = bsrc[stride + i];
463 if (slice_height <= 1)
469 for (i = step; i < width * step; i += step) {
470 B = bsrc[i - stride2];
475 for (i = 0; i < width * step; i += step) {
479 A = bsrc[stride + i];
483 for (j = 2; j < slice_height; j++) {
484 for (i = 0; i < width * step; i += step) {
485 B = bsrc[i - stride2];
490 for (i = 0; i < width * step; i += step) {
505 int buf_size = avpkt->
size;
509 int plane_size, max_slice_size = 0, slice_start,
slice_end, slice_size;
526 for (i = 0; i < c->
planes; i++) {
527 plane_start[i] = gb.
buffer;
534 for (j = 0; j < c->
slices; j++) {
535 slice_end = bytestream2_get_le32u(&gb);
536 if (slice_end < 0 || slice_end < slice_start ||
541 slice_size = slice_end - slice_start;
543 max_slice_size =
FFMAX(max_slice_size, slice_size);
551 for (i = 0; i < c->
planes; i++) {
552 plane_start[i] = gb.
buffer;
560 for (j = 0; j < c->
slices; j++) {
561 slice_end = bytestream2_get_le32u(&gb);
562 if (slice_end < 0 || slice_end < slice_start ||
567 slice_size = slice_end - slice_start;
569 max_slice_size =
FFMAX(max_slice_size, slice_size);
602 for (i = 0; i < c->
planes; i++) {
605 avctx->
height, plane_start[i],
627 for (i = 0; i < c->
planes; i++) {
630 avctx->
height, plane_start[i],
631 plane_start[i + 1] - 1024,
639 for (i = 0; i < 3; i++) {
660 for (i = 0; i < 3; i++) {
680 for (i = 0; i < 3; i++) {
734 "Insufficient extradata size %d, should be at least 16\n",
742 case MKTAG(
'U',
'L',
'R',
'G'):
746 case MKTAG(
'U',
'L',
'R',
'A'):
750 case MKTAG(
'U',
'L',
'Y',
'0'):
755 case MKTAG(
'U',
'L',
'Y',
'2'):
760 case MKTAG(
'U',
'Q',
'Y',
'2'):
764 case MKTAG(
'U',
'Q',
'R',
'G'):
768 case MKTAG(
'U',
'Q',
'R',
'A'):
772 case MKTAG(
'U',
'L',
'H',
'0'):
777 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.
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
#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 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 void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
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 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)
#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)
static int decode_plane10(UtvideoContext *c, int plane_no, uint16_t *dst, int step, int stride, int width, int height, const uint8_t *src, const uint8_t *huff, int use_pred)
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 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.
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.
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.
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)
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.