56 8, 6, 5, 8, 12, 20, 26, 31,
57 6, 6, 7, 10, 13, 29, 30, 28,
58 7, 7, 8, 12, 20, 29, 35, 28,
59 7, 9, 11, 15, 26, 44, 40, 31,
60 9, 11, 19, 28, 34, 55, 52, 39,
61 12, 18, 28, 32, 41, 52, 57, 46,
62 25, 32, 39, 44, 52, 61, 60, 51,
63 36, 46, 48, 49, 56, 50, 52, 50
67 9, 9, 12, 24, 50, 50, 50, 50,
68 9, 11, 13, 33, 50, 50, 50, 50,
69 12, 13, 28, 50, 50, 50, 50, 50,
70 24, 33, 50, 50, 50, 50, 50, 50,
71 50, 50, 50, 50, 50, 50, 50, 50,
72 50, 50, 50, 50, 50, 50, 50, 50,
73 50, 50, 50, 50, 50, 50, 50, 50,
74 50, 50, 50, 50, 50, 50, 50, 50,
117 const uint8_t *val_table,
int nb_codes,
120 uint8_t huff_size[256] = { 0 };
121 uint16_t huff_code[256];
122 uint16_t huff_sym[256];
127 for (i = 0; i < 256; i++)
128 huff_sym[i] = i + 16 * is_ac;
131 huff_sym[0] = 16 * 256;
134 huff_code, 2, 2, huff_sym, 2, 2, 0);
170 for (i = 0; i < 2; i++) {
181 const uint8_t *src_end = src + src_size;
184 while (src < src_end) {
189 if (x == 0xFF && !*src)
192 *dst_size = dst - dst_start;
199 const int is_chroma = !!
plane;
234 out[0] = av_clip_uint8(Y + ( 91881 * V + 32768 >> 16));
235 out[1] = av_clip_uint8(Y + (-22554 * U - 46802 * V + 32768 >> 16));
236 out[2] = av_clip_uint8(Y + (116130 * U + 32768 >> 16));
246 int mb_w, mb_h, mb_x, mb_y, i, j;
261 mb_h = (height + 15) >> 4;
264 num_mbs = mb_w * mb_h * 4;
266 for (i = 0; i < 3; i++)
271 for (mb_y = 0; mb_y < mb_h; mb_y++) {
272 for (mb_x = 0; mb_x < mb_w; mb_x++) {
273 if (mask && !mask[mb_x * 2] && !mask[mb_x * 2 + 1] &&
274 !mask[mb_x * 2 + mask_stride] &&
275 !mask[mb_x * 2 + 1 + mask_stride]) {
279 for (j = 0; j < 2; j++) {
280 for (i = 0; i < 2; i++) {
281 if (mask && !mask[mb_x * 2 + i + j * mask_stride])
285 c->
block[i + j * 2])) != 0)
290 for (i = 1; i < 3; i++) {
296 for (j = 0; j < 16; j++) {
297 uint8_t *
out = dst + bx * 3 + (by + j) * dst_stride;
298 for (i = 0; i < 16; i++) {
301 Y = c->
block[(j >> 3) * 2 + (i >> 3)][(i & 7) + (j & 7) * 8];
302 U = c->
block[4 ^ swapuv][(i >> 1) + (j >> 1) * 8] - 128;
303 V = c->
block[5 ^ swapuv][(i >> 1) + (j >> 1) * 8] - 128;
315 mask += mask_stride * 2;
323 const uint8_t *jpeg_tile,
int tile_stride,
325 const uint8_t *pal,
int npal,
int tidx)
334 if (npal <= 2) nb = 1;
335 else if (npal <= 4) nb = 2;
336 else if (npal <= 16) nb = 4;
339 for (j = 0; j <
height; j++, dst +=
stride, jpeg_tile += tile_stride) {
342 for (i = 0; i <
width; i++) {
345 memcpy(dst + i * 3, pal + col * 3, 3);
347 memcpy(dst + i * 3, jpeg_tile + i * 3, 3);
358 int hdr, zsize, npal, tidx = -1,
ret;
360 const uint8_t *src_end = src + src_size;
364 int nblocks, cblocks, bstride;
365 int bits, bitbuf, coded;
379 memcpy(transp, src, 3);
382 for (i = 0; i <
width; i++)
383 memcpy(dst + i * 3, transp, 3);
385 }
else if (sub_type == 1) {
391 memcpy(transp, src, 3);
395 if (src_end - src < npal * 3)
397 memcpy(pal, src, npal * 3);
400 for (i = 0; i < npal; i++) {
401 if (!memcmp(pal + i * 3, transp, 3)) {
408 if (src_end - src < 2)
410 zsize = (src[0] << 8) | src[1];
413 if (src_end - src < zsize + (sub_type != 2))
423 NULL, 0, width, height, pal, npal, tidx);
427 nblocks = *src++ + 1;
429 bstride =
FFALIGN(width, 16) >> 3;
432 for (i = 0; i < (FFALIGN(height, 16) >> 4); i++) {
433 for (j = 0; j < (FFALIGN(width, 16) >> 4); j++) {
444 if (cblocks > nblocks)
449 c->
kempf_flags[j * 2 + 1 + (i * 2 + 1) * bstride] = coded;
460 width, height, pal, npal, tidx);
471 aligned_height = c->
height + 15;
505 uint32_t cur_size, cursor_w, cursor_h, cursor_stride;
506 uint32_t cursor_hot_x, cursor_hot_y;
509 cur_size = bytestream2_get_be32(gb);
510 cursor_w = bytestream2_get_byte(gb);
511 cursor_h = bytestream2_get_byte(gb);
512 cursor_hot_x = bytestream2_get_byte(gb);
513 cursor_hot_y = bytestream2_get_byte(gb);
514 cursor_fmt = bytestream2_get_byte(gb);
516 cursor_stride =
FFALIGN(cursor_w, cursor_fmt==1 ? 32 : 1) * 4;
518 if (cursor_w < 1 || cursor_w > 256 ||
519 cursor_h < 1 || cursor_h > 256) {
524 if (cursor_hot_x > cursor_w || cursor_hot_y > cursor_h) {
526 cursor_hot_x, cursor_hot_y);
527 cursor_hot_x =
FFMIN(cursor_hot_x, cursor_w - 1);
528 cursor_hot_y =
FFMIN(cursor_hot_y, cursor_h - 1);
536 if (cursor_fmt != 1 && cursor_fmt != 32) {
558 for (i = 0; i < c->
cursor_w; i += 32) {
559 bits = bytestream2_get_be32(gb);
560 for (k = 0; k < 32; k++) {
561 dst[0] = !!(bits & 0x80000000);
570 for (i = 0; i < c->
cursor_w; i += 32) {
571 bits = bytestream2_get_be32(gb);
572 for (k = 0; k < 32; k++) {
573 int mask_bit = !!(bits & 0x80000000);
574 switch (dst[0] * 2 + mask_bit) {
604 int val = bytestream2_get_be32(gb);
618 #define APPLY_ALPHA(src, new, alpha) \
619 src = (src * (256 - alpha) + new * alpha) >> 8
637 if (x + w > c->
width)
656 for (j = 0; j <
h; j++) {
657 for (i = 0; i < w; i++) {
659 APPLY_ALPHA(dst[i * 3 + 0], cursor[i * 4 + 1], alpha);
660 APPLY_ALPHA(dst[i * 3 + 1], cursor[i * 4 + 2], alpha);
661 APPLY_ALPHA(dst[i * 3 + 2], cursor[i * 4 + 3], alpha);
669 int *got_picture_ptr,
AVPacket *avpkt)
672 int buf_size = avpkt->
size;
678 uint32_t chunk_size, r_mask, g_mask, b_mask;
685 "Frame should have at least 12 bytes, got %d instead\n",
692 magic = bytestream2_get_be32(&bc);
693 if ((magic & ~0xF) !=
MKBETAG(
'G',
'2',
'M',
'0') ||
694 (magic & 0xF) < 2 || (magic & 0xF) > 5) {
699 if ((magic & 0xF) < 4) {
705 chunk_size = bytestream2_get_le32(&bc) - 1;
706 chunk_type = bytestream2_get_byte(&bc);
710 chunk_size, chunk_type);
713 switch (chunk_type) {
717 if (chunk_size < 21) {
722 c->
width = bytestream2_get_be32(&bc);
723 c->
height = bytestream2_get_be32(&bc);
727 "Invalid frame dimensions %dx%d\n",
740 "Unknown compression method %d\n",
752 "Invalid tile dimensions %dx%d\n",
759 c->
bpp = bytestream2_get_byte(&bc);
762 (chunk_size - 21) < 16) {
764 "Display info: missing bitmasks!\n");
768 r_mask = bytestream2_get_be32(&bc);
769 g_mask = bytestream2_get_be32(&bc);
770 b_mask = bytestream2_get_be32(&bc);
771 if (r_mask != 0xFF0000 || g_mask != 0xFF00 || b_mask != 0xFF) {
773 "Invalid or unsupported bitmasks: R=%"PRIX32
", G=%"PRIX32
", B=%"PRIX32
"\n",
774 r_mask, g_mask, b_mask);
792 "No display info - skipping tile\n");
795 if (chunk_size < 2) {
800 c->
tile_x = bytestream2_get_byte(&bc);
801 c->
tile_y = bytestream2_get_byte(&bc);
804 "Invalid tile pos %d,%d (in %dx%d grid)\n",
812 "ePIC j-b compression is not implemented yet\n");
825 if (chunk_size < 5) {
830 c->
cursor_x = bytestream2_get_be16(&bc);
831 c->
cursor_y = bytestream2_get_be16(&bc);
834 if (chunk_size < 8) {
864 for (i = 0; i < avctx->
height; i++)
870 *got_picture_ptr = 1;
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int kempf_decode_tile(G2MContext *c, int tile_x, int tile_y, const uint8_t *src, int src_size)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
void(* clear_block)(int16_t *block)
static av_cold void jpg_free_context(JPGContext *ctx)
static int chunk_start(AVFormatContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
packed RGB 8:8:8, 24bpp, RGBRGB...
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
static av_cold int init(AVCodecContext *avctx)
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)
void(* clear_blocks)(int16_t *blocks)
#define DECLARE_ALIGNED(n, t, v)
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 g2m_init_buffers(G2MContext *c)
MJPEG encoder and decoder.
static void jpg_unescape(const uint8_t *src, int src_size, uint8_t *dst, int *dst_size)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code, const uint8_t *bits_table, const uint8_t *val_table)
const uint8_t avpriv_mjpeg_bits_dc_luminance[17]
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory.
bitstream reader API header.
static av_cold int g2m_decode_init(AVCodecContext *avctx)
static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c)
static double alpha(void *priv, double x, double y)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint16_t mask[17]
static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c, GetByteContext *gb)
static av_cold int g2m_decode_end(AVCodecContext *avctx)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
const uint8_t avpriv_mjpeg_bits_dc_chrominance[17]
#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)
const char * name
Name of the codec implementation.
Libavcodec external API header.
static int jpg_decode_block(JPGContext *c, GetBitContext *gb, int plane, int16_t *block)
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
enum AVPictureType pict_type
Picture type of the frame.
static int jpg_decode_data(JPGContext *c, int width, int height, const uint8_t *src, int src_size, uint8_t *dst, int dst_stride, const uint8_t *mask, int mask_stride, int num_mbs, int swapuv)
static int g2m_decode_frame(AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt)
int width
picture width / height.
static void g2m_paint_cursor(G2MContext *c, uint8_t *dst, int stride)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
uint8_t idct_permutation[64]
IDCT input permutation.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static av_always_inline int bytestream2_tell(GetByteContext *g)
static void yuv2rgb(uint8_t *out, int Y, int U, int V)
av_cold void ff_blockdsp_init(BlockDSPContext *c, AVCodecContext *avctx)
static int kempf_restore_buf(const uint8_t *src, int len, uint8_t *dst, int stride, const uint8_t *jpeg_tile, int tile_stride, int width, int height, const uint8_t *pal, int npal, int tidx)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define APPLY_ALPHA(src, new, alpha)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
static av_cold int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table, int nb_codes, int is_ac)
static int get_xbits(GetBitContext *s, int n)
read mpeg1 dc style vlc (sign bit + mantissa with no MSB).
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
const uint8_t avpriv_mjpeg_val_dc[12]
BYTE int const BYTE int int int height
const uint8_t ff_zigzag_direct[64]
const uint8_t avpriv_mjpeg_bits_ac_chrominance[17]
static const uint8_t chroma_quant[64]
const uint8_t avpriv_mjpeg_val_ac_chrominance[]
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
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
common internal api header.
static const uint8_t luma_quant[64]
#define MKBETAG(a, b, c, d)
const uint8_t avpriv_mjpeg_bits_ac_luminance[17]
av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
const uint8_t avpriv_mjpeg_val_ac_luminance[]
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
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){if(!*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));if(!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=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);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);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) 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_log(ac->avr, AV_LOG_TRACE,"%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
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){if(!*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));if(!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=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);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);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) 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_log(ac->avr, AV_LOG_TRACE,"%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-> dc
static void * av_mallocz_array(size_t nmemb, size_t size)
This structure stores compressed data.
void ff_free_vlc(VLC *vlc)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
void(* idct)(int16_t *block)