40 #include "libavutil/imgutils.h"
41 #include "libavutil/avassert.h"
110 unsigned int exp = v >> 23;
113 if (exp<= 127 + 7 - 24)
118 return (v + (1 << 23)) >> (127 + 7 - exp);
129 unsigned exp = 14 - (v >> 10);
131 if (exp == 14)
return (v >> 9) & 1;
132 else return (v & 0x8000) ? 0 : 0xffff;
135 return (v + (1 << 16)) >> (exp + 1);
149 unsigned int variable_buffer_data_size = bytestream_get_le32(buf);
150 if (variable_buffer_data_size >= buf_end - *buf)
152 return variable_buffer_data_size;
172 const char *value_name,
173 const char *value_type,
174 unsigned int minimum_length,
175 unsigned int *variable_buffer_data_size)
177 if (buf_end - *buf >= minimum_length && !strcmp(*buf, value_name)) {
178 *buf += strlen(value_name)+1;
179 if (!strcmp(*buf, value_type)) {
180 *buf += strlen(value_type)+1;
182 if (!*variable_buffer_data_size)
186 *buf -= strlen(value_name)+1;
198 int d = (int)t[-1] + (
int)t[0] - 128;
206 const int8_t *
t1 =
src;
207 const int8_t *
t2 = src + (size + 1) / 2;
209 int8_t *stop = s +
size;
227 unsigned long dest_len = uncompressed_size;
229 if (uncompress(td->
tmp, &dest_len, src, compressed_size) != Z_OK ||
230 dest_len != uncompressed_size)
242 int8_t *d = (int8_t *)td->
tmp;
243 const int8_t *
s = (
const int8_t *)
src;
244 int ssize = compressed_size;
245 int dsize = uncompressed_size;
246 int8_t *dend = d + dsize;
255 if ((dsize -= count ) < 0 ||
256 (ssize -= count + 1) < 0)
264 if ((dsize -= count) < 0 ||
284 #define USHORT_RANGE (1 << 16)
285 #define BITMAP_SIZE (1 << 13)
292 if ((i == 0) || (bitmap[i >> 3] & (1 << (i & 7))))
298 memset(lut + k, 0, (USHORT_RANGE - k) * 2);
303 static void apply_lut(
const uint16_t *lut, uint16_t *dst,
int dsize)
307 for (i = 0; i < dsize; ++i)
308 dst[i] = lut[dst[i]];
311 #define HUF_ENCBITS 16 // literal (value) bit length
312 #define HUF_DECBITS 14 // decoding bit size (>= 8)
314 #define HUF_ENCSIZE ((1 << HUF_ENCBITS) + 1) // encoding table size
315 #define HUF_DECSIZE (1 << HUF_DECBITS) // decoding table size
316 #define HUF_DECMASK (HUF_DECSIZE - 1)
326 uint64_t
c,
n[59] = { 0 };
333 for (i = 58; i > 0; --i) {
334 uint64_t nc = ((c + n[i]) >> 1);
343 hcode[i] = l | (n[l]++ << 6);
347 #define SHORT_ZEROCODE_RUN 59
348 #define LONG_ZEROCODE_RUN 63
349 #define SHORTEST_LONG_RUN (2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN)
350 #define LONGEST_LONG_RUN (255 + SHORTEST_LONG_RUN)
359 for (; im <= iM; im++) {
365 if (im + zerun > iM + 1)
373 int zerun = l - SHORT_ZEROCODE_RUN + 2;
375 if (im + zerun > iM + 1)
394 for (; im <= iM; im++) {
395 uint64_t
c = hcode[
im] >> 6;
396 int i, l = hcode[
im] & 63;
416 for (i = 1 << (
HUF_DECBITS - l); i > 0; i--, pl++) {
417 if (pl->
len || pl->
p)
428 #define get_char(c, lc, gb) { \
429 c = (c << 8) | bytestream2_get_byte(gb); \
433 #define get_code(po, rlc, c, lc, gb, out, oe) { \
436 get_char(c, lc, gb); \
442 return AVERROR_INVALIDDATA; \
448 } else if (out < oe) { \
451 return AVERROR_INVALIDDATA; \
457 int rlc,
int no, uint16_t *
out)
460 uint16_t *outb =
out;
461 uint16_t *oe = out + no;
481 for (j = 0; j < pl.
lit; j++) {
482 int l = hcode[pl.
p[j]] & 63;
488 if ((hcode[pl.
p[j]] >> 6) ==
489 ((c >> (lc - l)) & ((1LL << l) - 1))) {
491 get_code(pl.
p[j], rlc, c, lc, gb, out, oe);
518 if (out - outb != no)
524 uint16_t *dst,
int dst_size)
532 src_size = bytestream2_get_le32(gb);
533 im = bytestream2_get_le32(gb);
534 iM = bytestream2_get_le32(gb);
536 nBits = bytestream2_get_le32(gb);
546 if (!freq || !hdec) {
561 ret =
huf_decode(freq, hdec, gb, nBits, iM, dst_size, dst);
575 static inline void wdec14(uint16_t l, uint16_t h, uint16_t *
a, uint16_t *
b)
580 int ai = ls + (hi & 1) + (hi >> 1);
582 int16_t bs = ai - hi;
589 #define A_OFFSET (1 << (NBITS - 1))
590 #define MOD_MASK ((1 << NBITS) - 1)
592 static inline void wdec16(uint16_t l, uint16_t h, uint16_t *
a, uint16_t *
b)
603 int ny,
int oy, uint16_t mx)
605 int w14 = (mx < (1 << 14));
606 int n = (nx > ny) ? ny: nx;
619 uint16_t *ey = in + oy * (ny - p2);
620 uint16_t i00, i01, i10, i11;
626 for (; py <= ey; py += oy2) {
628 uint16_t *ex = py + ox * (nx - p2);
630 for (; px <= ex; px += ox2) {
631 uint16_t *p01 = px + ox1;
632 uint16_t *p10 = px + oy1;
633 uint16_t *p11 = p10 + ox1;
636 wdec14(*px, *p10, &i00, &i10);
637 wdec14(*p01, *p11, &i01, &i11);
638 wdec14(i00, i01, px, p01);
639 wdec14(i10, i11, p10, p11);
641 wdec16(*px, *p10, &i00, &i10);
642 wdec16(*p01, *p11, &i01, &i11);
643 wdec16(i00, i01, px, p01);
644 wdec16(i10, i11, p10, p11);
649 uint16_t *p10 = px + oy1;
652 wdec14(*px, *p10, &i00, p10);
654 wdec16(*px, *p10, &i00, p10);
662 uint16_t *ex = py + ox * (nx - p2);
664 for (; px <= ex; px += ox2) {
665 uint16_t *p01 = px + ox1;
668 wdec14(*px, *p01, &i00, p01);
670 wdec16(*px, *p01, &i00, p01);
684 uint16_t maxval, min_non_zero, max_non_zero;
685 uint16_t *ptr, *tmp = (uint16_t *)td->
tmp;
697 min_non_zero = bytestream2_get_le16(&gb);
698 max_non_zero = bytestream2_get_le16(&gb);
704 if (min_non_zero <= max_non_zero)
706 max_non_zero - min_non_zero + 1);
720 for (j = 0; j <
size; j++)
728 for (i = 0; i < s->
ysize; i++) {
740 int compressed_size,
int uncompressed_size,
743 unsigned long dest_len = uncompressed_size;
748 if (uncompress(td->
tmp, &dest_len, src, compressed_size) != Z_OK ||
749 dest_len != uncompressed_size)
753 for (i = 0; i < s->
ysize; i++) {
762 ptr[1] = ptr[0] + s->
xdelta;
763 ptr[2] = ptr[1] + s->
xdelta;
766 for (j = 0; j < s->
xdelta; ++j) {
767 uint32_t diff = (*(ptr[0]++) << 24) |
768 (*(ptr[1]++) << 16) |
771 bytestream_put_le32(&out, pixel);
776 ptr[1] = ptr[0] + s->
xdelta;
778 for (j = 0; j < s->
xdelta; j++) {
779 uint32_t diff = (*(ptr[0]++) << 8) | *(ptr[1]++);
782 bytestream_put_le16(&out, pixel);
795 int jobnr,
int threadnr)
800 const uint8_t *channel_buffer[4] = { 0 };
802 uint64_t line_offset, uncompressed_size;
803 uint32_t xdelta = s->
xdelta;
815 if (line_offset > buf_size - 8)
818 src = buf + line_offset + 8;
824 if (data_size <= 0 || data_size > buf_size)
829 if ((s->
compr ==
EXR_RAW && (data_size != uncompressed_size ||
830 line_offset > buf_size - uncompressed_size)) ||
831 (s->
compr !=
EXR_RAW && (data_size > uncompressed_size ||
832 line_offset > buf_size - data_size))) {
836 if (data_size < uncompressed_size) {
870 r = channel_buffer[0];
871 g = channel_buffer[1];
872 b = channel_buffer[2];
873 if (channel_buffer[3])
874 a = channel_buffer[3];
876 ptr_x = (uint16_t *)ptr;
879 memset(ptr_x, 0, bxmin);
883 for (x = 0; x < xdelta; x++) {
887 if (channel_buffer[3])
892 for (x = 0; x < xdelta; x++) {
896 if (channel_buffer[3])
902 memset(ptr_x, 0, axmax);
907 if (channel_buffer[3])
920 unsigned int buf_size = avpkt->
size;
921 const uint8_t *buf_end = buf + buf_size;
933 int scan_line_blocks;
935 unsigned int current_channel_offset = 0;
958 magic_number = bytestream_get_le32(&buf);
959 if (magic_number != 20000630) {
964 version = bytestream_get_byte(&buf);
970 flags = bytestream_get_le24(&buf);
977 while (buf < buf_end && buf[0]) {
978 unsigned int variable_buffer_data_size;
980 if (
check_header_variable(avctx, &buf, buf_end,
"channels",
"chlist", 38, &variable_buffer_data_size) >= 0) {
981 const uint8_t *channel_list_end;
982 if (!variable_buffer_data_size)
985 channel_list_end = buf + variable_buffer_data_size;
986 while (channel_list_end - buf >= 19) {
989 int channel_index = -1;
992 if (!strcmp(buf,
"R"))
994 else if (!strcmp(buf,
"G"))
996 else if (!strcmp(buf,
"B"))
998 else if (!strcmp(buf,
"A"))
1003 while (bytestream_get_byte(&buf) && buf < channel_list_end)
1006 if (channel_list_end - * &buf < 4) {
1011 current_pixel_type = bytestream_get_le32(&buf);
1012 if (current_pixel_type > 2) {
1018 xsub = bytestream_get_le32(&buf);
1019 ysub = bytestream_get_le32(&buf);
1020 if (xsub != 1 || ysub != 1) {
1025 if (channel_index >= 0) {
1039 channel->
xsub = xsub;
1040 channel->
ysub = ysub;
1042 current_channel_offset += 1 << current_pixel_type;
1060 buf = channel_list_end;
1062 }
else if (
check_header_variable(avctx, &buf, buf_end,
"dataWindow",
"box2i", 31, &variable_buffer_data_size) >= 0) {
1063 if (!variable_buffer_data_size)
1073 buf += variable_buffer_data_size;
1075 }
else if (
check_header_variable(avctx, &buf, buf_end,
"displayWindow",
"box2i", 34, &variable_buffer_data_size) >= 0) {
1076 if (!variable_buffer_data_size)
1082 buf += variable_buffer_data_size;
1084 }
else if (
check_header_variable(avctx, &buf, buf_end,
"lineOrder",
"lineOrder", 25, &variable_buffer_data_size) >= 0) {
1085 if (!variable_buffer_data_size)
1094 buf += variable_buffer_data_size;
1096 }
else if (
check_header_variable(avctx, &buf, buf_end,
"pixelAspectRatio",
"float", 31, &variable_buffer_data_size) >= 0) {
1097 if (!variable_buffer_data_size)
1102 buf += variable_buffer_data_size;
1104 }
else if (
check_header_variable(avctx, &buf, buf_end,
"compression",
"compression", 29, &variable_buffer_data_size) >= 0) {
1105 if (!variable_buffer_data_size)
1113 buf += variable_buffer_data_size;
1118 if (buf_end - buf <= 9) {
1124 for (i = 0; i < 2; i++) {
1126 while (++buf < buf_end)
1132 if (buf_end - buf >= 5) {
1134 if (!variable_buffer_data_size) {
1138 buf += variable_buffer_data_size;
1142 if (s->
compr == -1) {
1147 if (buf >= buf_end) {
1209 size_t thread_data_size, prev_size;
1226 if (buf_end - buf < scan_line_blocks * 8)
1229 ptr = picture->
data[0];
1232 for (y = 0; y < s->
ymin; y++) {
1233 memset(ptr, 0, out_line_size);
1241 for (y = s->
ymax + 1; y < avctx->
height; y++) {
1242 memset(ptr, 0, out_line_size);
static uint16_t exr_flt2uint(uint32_t v)
Converts from 32-bit float as uint32_t to uint16_t.
static unsigned int get_header_variable_length(const uint8_t **buf, const uint8_t *buf_end)
Gets the size of the header variable.
void * av_calloc(size_t nmemb, size_t size) av_malloc_attrib
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
#define AVERROR_PATCHWELCOME
This structure describes decoded (raw) audio or video data.
static uint16_t reverse_lut(const uint8_t *bitmap, uint16_t *lut)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
static int pxr24_uncompress(EXRContext *s, const uint8_t *src, int compressed_size, int uncompressed_size, EXRThreadData *td)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
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_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional FF_INPUT_BUFFER_PADDING_SIZE at the end w...
enum ExrPixelType pixel_type
static int decode_block(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr)
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int check_header_variable(AVCodecContext *avctx, const uint8_t **buf, const uint8_t *buf_end, const char *value_name, const char *value_type, unsigned int minimum_length, unsigned int *variable_buffer_data_size)
Checks if the variable name corresponds with it's data type.
static void wav_decode(uint16_t *in, int nx, int ox, int ny, int oy, uint16_t mx)
Multithreading support functions.
static int huf_uncompress(GetByteContext *gb, uint16_t *dst, int dst_size)
const char * name
Name of the codec implementation.
static int huf_build_dec_table(const uint64_t *hcode, int im, int iM, HufDec *hdecod)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define get_char(c, lc, gb)
static int get_bits_count(const GetBitContext *s)
bitstream reader API header.
#define AV_PIX_FMT_RGBA64
uint8_t * uncompressed_data
static int huf_decode(const uint64_t *hcode, const HufDec *hdecod, GetByteContext *gb, int nbits, int rlc, int no, uint16_t *out)
static void predictor(uint8_t *src, int size)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);ff_audio_convert_init_arm(ac);ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_dlog(ac->avr,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#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_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
static void reorder_pixels(uint8_t *src, uint8_t *dst, int size)
enum ExrPixelType pixel_type
#define LONG_ZEROCODE_RUN
Libavcodec external API header.
#define av_unused
Disable warnings about deprecated features This is useful for sections of code kept for backward comp...
EXRThreadData * thread_data
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
uint8_t nb_components
The number of components each pixel has, (1-4)
AVRational av_d2q(double d, int max) av_const
Convert a double precision floating point number to a rational.
enum AVPictureType pict_type
Picture type of the frame.
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
int width
picture width / height.
static int av_size_mult(size_t a, size_t b, size_t *r)
Multiply two size_t values checking for overflow.
static uint16_t exr_halflt2uint(uint16_t v)
Converts from 16-bit float as uint16_t to uint16_t.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
#define SHORTEST_LONG_RUN
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
static void close(AVCodecParserContext *s)
void * av_realloc_f(void *ptr, size_t nelem, size_t elsize)
Allocate or reallocate a block of memory.
static int zip_uncompress(const uint8_t *src, int compressed_size, int uncompressed_size, EXRThreadData *td)
BYTE int const BYTE int int int height
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define get_code(po, rlc, c, lc, gb, out, oe)
static av_cold int decode_end(AVCodecContext *avctx)
static int rle_uncompress(const uint8_t *src, int compressed_size, int uncompressed_size, EXRThreadData *td)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define SHORT_ZEROCODE_RUN
#define CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
#define CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
#define AVERROR_INVALIDDATA
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);ff_audio_convert_init_arm(ac);ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_dlog(ac->avr,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize, int dsize, EXRThreadData *td)
static void huf_canonical_code_table(uint64_t *hcode)
static void apply_lut(const uint16_t *lut, uint16_t *dst, int dsize)
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static void wdec14(uint16_t l, uint16_t h, uint16_t *a, uint16_t *b)
static void wdec16(uint16_t l, uint16_t h, uint16_t *a, uint16_t *b)
static int huf_unpack_enc_table(GetByteContext *gb, int32_t im, int32_t iM, uint64_t *hcode)
const AVPixFmtDescriptor * desc
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.