51 for (i = 0; i < 1024; i++) {
63 while (he[last].len == 255 && last)
66 if (he[last].len > 32) {
71 for (i = last; i >= 0; i--) {
72 codes[i] = code >> (32 - he[i].
len);
75 code += 0x80000000
u >> (he[i].
len - 1);
79 bits,
sizeof(*bits),
sizeof(*bits),
80 codes,
sizeof(*codes),
sizeof(*codes),
81 syms,
sizeof(*syms),
sizeof(*syms), 0);
95 for (i = 0; i < 256; i++) {
107 while (he[last].len == 255 && last)
110 if (he[last].len > 32)
114 for (i = last; i >= 0; i--) {
115 codes[i] = code >> (32 - he[i].
len);
118 code += 0x80000000
u >> (he[i].
len - 1);
122 bits,
sizeof(*bits),
sizeof(*bits),
123 codes,
sizeof(*codes),
sizeof(*codes),
124 syms,
sizeof(*syms),
sizeof(*syms), 0);
128 uint16_t *dst,
int step, ptrdiff_t
stride,
133 int i, j, slice, pix, ret;
145 for (slice = 0; slice < c->
slices; slice++) {
149 send = (height * (slice + 1) / c->
slices);
150 dest = dst + sstart *
stride;
153 for (j = sstart; j < send; j++) {
154 for (i = 0; i < width * step; i += step) {
170 for (slice = 0; slice < c->
slices; slice++) {
172 int slice_data_start, slice_data_end, slice_size;
175 send = (height * (slice + 1) / c->
slices);
176 dest = dst + sstart *
stride;
179 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
180 slice_data_end =
AV_RL32(src + slice * 4);
181 slice_size = slice_data_end - slice_data_start;
185 "yet a slice has a length of zero.\n");
194 (slice_data_end - slice_data_start + 3) >> 2);
198 for (j = sstart; j < send; j++) {
199 for (i = 0; i < width * step; i += step) {
202 "Slice decoding ran out of bits\n");
237 int i, j, slice, pix;
250 for (slice = 0; slice < c->
slices; slice++) {
254 send = (height * (slice + 1) / c->
slices) & cmask;
255 dest = dst + sstart *
stride;
258 for (j = sstart; j < send; j++) {
259 for (i = 0; i < width * step; i += step) {
276 for (slice = 0; slice < c->
slices; slice++) {
278 int slice_data_start, slice_data_end, slice_size;
281 send = (height * (slice + 1) / c->
slices) & cmask;
282 dest = dst + sstart *
stride;
285 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
286 slice_data_end =
AV_RL32(src + slice * 4);
287 slice_size = slice_data_end - slice_data_start;
291 "yet a slice has a length of zero.\n");
300 (slice_data_end - slice_data_start + 3) >> 2);
304 for (j = sstart; j < send; j++) {
305 for (i = 0; i < width * step; i += step) {
308 "Slice decoding ran out of bits\n");
343 for (j = 0; j <
height; j++) {
344 for (i = 0; i < width * step; i += step) {
348 src[i] = r + g - 0x80;
349 src[i + 2] = b + g - 0x80;
357 uint16_t *src_r = (uint16_t *)frame->
data[2];
358 uint16_t *src_g = (uint16_t *)frame->
data[0];
359 uint16_t *src_b = (uint16_t *)frame->
data[1];
364 for (i = 0; i <
width; i++) {
368 src_r[i] = (r +
g - 0x200) & 0x3FF;
369 src_b[i] = (
b +
g - 0x200) & 0x3FF;
387 int slice_start, slice_height;
388 const int cmask = ~rmode;
390 for (slice = 0; slice < slices; slice++) {
391 slice_start = ((slice *
height) / slices) & cmask;
392 slice_height = ((((slice + 1) * height) / slices) & cmask) -
397 bsrc = src + slice_start *
stride;
403 if (slice_height <= 1)
409 for (i = 1; i <
width; i++) {
417 for (j = 2; j < slice_height; j++) {
419 bsrc, width, &A, &B);
435 int slice_start, slice_height;
436 const int cmask = ~(rmode ? 3 : 1);
437 const ptrdiff_t stride2 = stride << 1;
439 for (slice = 0; slice < slices; slice++) {
440 slice_start = ((slice *
height) / slices) & cmask;
441 slice_height = ((((slice + 1) * height) / slices) & cmask) -
447 bsrc = src + slice_start *
stride;
454 if (slice_height <= 1)
460 for (i = 1; i <
width; i++) {
461 B = bsrc[i - stride2];
467 bsrc + stride, width, &A, &B);
470 for (j = 2; j < slice_height; j++) {
472 bsrc, width, &A, &B);
474 bsrc + stride, width, &A, &B);
486 int slice_start, slice_height;
487 const int cmask = ~rmode;
489 for (slice = 0; slice < slices; slice++) {
490 slice_start = ((slice *
height) / slices) & cmask;
491 slice_height = ((((slice + 1) * height) / slices) & cmask) -
496 bsrc = src + slice_start *
stride;
501 for (i = step; i < width * step; i += step) {
506 if (slice_height <= 1)
512 for (i = step; i < width * step; i += step) {
520 for (j = 2; j < slice_height; j++) {
521 for (i = 0; i < width * step; i += step) {
542 int slice_start, slice_height;
543 const int cmask = ~(rmode ? 3 : 1);
544 const ptrdiff_t stride2 = stride << 1;
546 for (slice = 0; slice < slices; slice++) {
547 slice_start = ((slice *
height) / slices) & cmask;
548 slice_height = ((((slice + 1) * height) / slices) & cmask) -
554 bsrc = src + slice_start *
stride;
559 for (i = step; i < width * step; i += step) {
563 for (i = 0; i < width * step; i += step) {
564 bsrc[stride + i] +=
A;
565 A = bsrc[stride + i];
568 if (slice_height <= 1)
574 for (i = step; i < width * step; i += step) {
575 B = bsrc[i - stride2];
580 for (i = 0; i < width * step; i += step) {
584 A = bsrc[stride + i];
588 for (j = 2; j < slice_height; j++) {
589 for (i = 0; i < width * step; i += step) {
590 B = bsrc[i - stride2];
595 for (i = 0; i < width * step; i += step) {
610 int buf_size = avpkt->
size;
614 int plane_size, max_slice_size = 0, slice_start,
slice_end, slice_size;
631 for (i = 0; i < c->
planes; i++) {
632 plane_start[i] = gb.
buffer;
639 for (j = 0; j < c->
slices; j++) {
640 slice_end = bytestream2_get_le32u(&gb);
641 if (slice_end < 0 || slice_end < slice_start ||
646 slice_size = slice_end - slice_start;
648 max_slice_size =
FFMAX(max_slice_size, slice_size);
656 for (i = 0; i < c->
planes; i++) {
657 plane_start[i] = gb.
buffer;
665 for (j = 0; j < c->
slices; j++) {
666 slice_end = bytestream2_get_le32u(&gb);
667 if (slice_end < 0 || slice_end < slice_start ||
672 slice_size = slice_end - slice_start;
674 max_slice_size =
FFMAX(max_slice_size, slice_size);
707 for (i = 0; i < c->
planes; i++) {
710 avctx->
height, plane_start[i],
732 for (i = 0; i < c->
planes; i++) {
735 avctx->
height, plane_start[i],
736 plane_start[i + 1] - 1024,
744 for (i = 0; i < 3; i++) {
765 for (i = 0; i < 3; i++) {
785 for (i = 0; i < 3; i++) {
805 for (i = 0; i < 3; i++) {
828 int h_shift, v_shift;
838 case MKTAG(
'U',
'L',
'R',
'G'):
842 case MKTAG(
'U',
'L',
'R',
'A'):
846 case MKTAG(
'U',
'L',
'Y',
'0'):
851 case MKTAG(
'U',
'L',
'Y',
'2'):
856 case MKTAG(
'U',
'L',
'Y',
'4'):
861 case MKTAG(
'U',
'Q',
'Y',
'2'):
866 case MKTAG(
'U',
'Q',
'R',
'G'):
871 case MKTAG(
'U',
'Q',
'R',
'A'):
876 case MKTAG(
'U',
'L',
'H',
'0'):
881 case MKTAG(
'U',
'L',
'H',
'2'):
886 case MKTAG(
'U',
'L',
'H',
'4'):
898 if ((avctx->
width & ((1<<h_shift)-1)) ||
899 (avctx->
height & ((1<<v_shift)-1))) {
929 "Insufficient extradata size %d, should be at least 16\n",
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.
int(* add_left_pred)(uint8_t *dst, const uint8_t *src, ptrdiff_t w, int left)
This structure describes decoded (raw) audio or video data.
int ff_ut10_huff_cmp_len(const void *a, const void *b)
#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...
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
Multithreading support functions.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void(* add_median_pred)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, ptrdiff_t w, int *left, int *left_top)
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.
#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.
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)
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)
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.
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)