48 for (i = 0; i < 256; i++) {
62 while (he[last].len == 255 && last)
66 for (i = last; i >= 0; i--) {
67 codes[i] = code >> (32 - he[i].
len);
70 code += 0x80000000u >> (he[i].
len - 1);
74 bits,
sizeof(*bits),
sizeof(*bits),
75 codes,
sizeof(*codes),
sizeof(*codes),
76 syms,
sizeof(*syms),
sizeof(*syms), 0);
82 const uint8_t *src,
int use_pred)
97 for (slice = 0; slice < c->
slices; slice++) {
101 send = (height * (slice + 1) / c->
slices) & cmask;
102 dest = dst + sstart *
stride;
105 for (j = sstart; j < send; j++) {
106 for (i = 0; i < width *
step; i +=
step) {
123 for (slice = 0; slice < c->
slices; slice++) {
125 int slice_data_start, slice_data_end, slice_size;
128 send = (height * (slice + 1) / c->
slices) & cmask;
129 dest = dst + sstart *
stride;
132 slice_data_start = slice ?
AV_RL32(src + slice * 4 - 4) : 0;
133 slice_data_end =
AV_RL32(src + slice * 4);
134 slice_size = slice_data_end - slice_data_start;
138 "yet a slice has a length of zero.\n");
146 (slice_data_end - slice_data_start + 3) >> 2);
150 for (j = sstart; j < send; j++) {
151 for (i = 0; i < width *
step; i +=
step) {
154 "Slice decoding ran out of bits\n");
189 for (j = 0; j <
height; j++) {
190 for (i = 0; i < width *
step; i +=
step) {
194 src[i] = r + g - 0x80;
195 src[i + 2] = b + g - 0x80;
207 int slice_start, slice_height;
208 const int cmask = ~rmode;
210 for (slice = 0; slice < slices; slice++) {
211 slice_start = ((slice *
height) / slices) & cmask;
212 slice_height = ((((slice + 1) * height) / slices) & cmask) -
215 bsrc = src + slice_start *
stride;
220 for (i = step; i < width *
step; i +=
step) {
225 if (slice_height == 1)
231 for (i = step; i < width *
step; i +=
step) {
239 for (j = 2; j < slice_height; j++) {
240 for (i = 0; i < width *
step; i +=
step) {
261 int slice_start, slice_height;
262 const int cmask = ~(rmode ? 3 : 1);
263 const int stride2 = stride << 1;
265 for (slice = 0; slice < slices; slice++) {
266 slice_start = ((slice *
height) / slices) & cmask;
267 slice_height = ((((slice + 1) * height) / slices) & cmask) -
271 bsrc = src + slice_start *
stride;
276 for (i = step; i < width *
step; i +=
step) {
280 for (i = 0; i < width *
step; i +=
step) {
281 bsrc[stride + i] +=
A;
282 A = bsrc[stride + i];
285 if (slice_height == 1)
291 for (i = step; i < width *
step; i +=
step) {
292 B = bsrc[i - stride2];
297 for (i = 0; i < width *
step; i +=
step) {
301 A = bsrc[stride + i];
305 for (j = 2; j < slice_height; j++) {
306 for (i = 0; i < width *
step; i +=
step) {
307 B = bsrc[i - stride2];
312 for (i = 0; i < width *
step; i +=
step) {
327 int buf_size = avpkt->
size;
331 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);
398 for (i = 0; i < c->
planes; i++) {
401 avctx->
height, plane_start[i],
422 for (i = 0; i < 3; i++) {
443 for (i = 0; i < 3; i++) {
485 "Insufficient extradata size %d, should be at least 16\n",
508 case MKTAG(
'U',
'L',
'R',
'G'):
512 case MKTAG(
'U',
'L',
'R',
'A'):
516 case MKTAG(
'U',
'L',
'Y',
'0'):
520 case MKTAG(
'U',
'L',
'Y',
'2'):
static void restore_median(uint8_t *src, int step, int stride, int width, int height, int slices, int rmode)
av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
This structure describes decoded (raw) audio or video data.
int buffer_hints
codec suggestion on buffer type if != 0
packed RGB 8:8:8, 24bpp, RGBRGB...
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
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 ...
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
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)
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.
#define MKTAG(a, b, c, d)
int interlaced_frame
The content of the picture is interlaced.
const int ff_ut_rgb_order[4]
static int init(AVCodecParserContext *s)
static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
static int get_bits_left(GetBitContext *gb)
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...
static av_cold int decode_init(AVCodecContext *avctx)
Multithreading support functions.
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
void(* bswap_buf)(uint32_t *dst, const uint32_t *src, int w)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
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)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
#define CODEC_CAP_FRAME_THREADS
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_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]
Size, in bytes, of the data for each picture/channel plane.
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').
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define FF_INPUT_BUFFER_PADDING_SIZE
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)
struct UtvideoContext UtvideoContext
#define AVERROR_INVALIDDATA
#define AVERROR_PATCHWELCOME
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
#define FF_BUFFER_HINTS_VALID
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around get_buffer() for frame-multithreaded codecs.
AVCodec ff_utvideo_decoder
This structure stores compressed data.
void ff_free_vlc(VLC *vlc)
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.