27 #define BITSTREAM_READER_LE 37 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19,
38 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56,
39 14, 17, 22, 29, 51, 87, 80, 62, 18, 22, 37, 56,
40 68,109,103, 77, 24, 35, 55, 64, 81,104,113, 92,
41 49, 64, 78, 87,103,121,120,101, 72, 92, 95, 98,
46 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66,
47 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99,
48 47, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
49 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
50 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
87 int luma_quant_matrix[64];
88 int chroma_quant_matrix[64];
104 int len = 0, skip = 0,
max;
150 len = ((
show_bits(gb, 5) & 0x10) | 0xA0) >> 4;
161 max = 1 << (len - 1);
178 }
else if (mode == 0) {
195 const int *quant_matrix,
int *skip,
int *dc_level)
202 for (
int i = 0;
i < 64;
i++) {
212 for (
int k = 0; k < rskip; k++)
213 block[64 * k] = *dc_level * quant_matrix[0];
225 block[0] = (
i == 0 ? *dc_level :
level) * quant_matrix[
i];
236 const int *quant_matrix,
int *skip,
245 for (
int i = 0;
i < 64;
i++) {
261 block[0] = level * quant_matrix[
i];
272 const int *quant_matrix,
int *skip,
int *dc_level)
279 memset(block, 0,
sizeof(s->
block));
289 block[scantable[0]] = offset + *dc_level * quant_matrix[0];
291 for (
int i = 1;
i < 64;) {
295 rskip =
FFMIN(*skip, 64 -
i);
303 block[scantable[
i]] = level * quant_matrix[
i];
315 int ret, skip = 0, dc_level = 0;
361 const int *quant_matrix,
int *skip,
368 memset(block, 0,
sizeof(s->
block));
370 for (
int i = 0;
i < 64;) {
374 rskip =
FFMIN(*skip, 64 -
i);
382 block[scantable[
i]] = level * quant_matrix[
i];
416 int shift = plane == 0;
425 if (orig_mv_x >= -32) {
426 if (
y * 8 + mv_y < 0 || y * 8 + mv_y + 8 >= h ||
427 x * 8 + mv_x < 0 || x * 8 + mv_x + 8 >= w)
435 for (
int i = 0;
i < 64;
i++)
446 }
else if (s->
flags & 2) {
449 int shift = plane == 0;
462 if (orig_mv_x >= -32) {
463 if (
y * 8 + mv_y < 0 || y * 8 + mv_y + 8 > h ||
464 x * 8 + mv_x < 0 || x * 8 + mv_x + 8 > w)
472 for (
int i = 0;
i < 64;
i++)
483 }
else if (s->
flags & 1) {
535 double f = 1.0 - fabs(qscale);
539 for (
int i = 0;
i < 64;
i++) {
540 luma[
i] =
FFMAX(1, 16 * f);
541 chroma[
i] =
FFMAX(1, 16 * f);
544 for (
int i = 0;
i < 64;
i++) {
545 luma[
i] =
FFMAX(1, 16 - qscale * 32);
546 chroma[
i] =
FFMAX(1, 16 - qscale * 32);
551 for (
int i = 0;
i < 64;
i++) {
556 for (
int i = 0;
i < 64;
i++) {
563 for (
int i = 0;
i < 64;
i++) {
579 for (
int y = 0;
y < avctx->
height;
y++) {
580 for (
int x = 0;
x < avctx->
width;
x++) {
581 dst[
x*3+0] = bytestream2_get_byteu(gbyte) +
r;
583 dst[
x*3+1] = bytestream2_get_byteu(gbyte) +
g;
585 dst[
x*3+2] = bytestream2_get_byteu(gbyte) +
b;
596 int ylinesize,
int ulinesize,
int vlinesize,
598 int *nx,
int *ny,
int *np,
int w,
int h)
604 int x = *nx,
y = *ny,
pos = *np;
607 y0dst[2*x+0] += fill[0];
608 y0dst[2*x+1] += fill[1];
609 y1dst[2*x+0] += fill[2];
610 y1dst[2*x+1] += fill[3];
612 }
else if (pos == 1) {
621 y0dst -= 2*ylinesize;
622 y1dst -= 2*ylinesize;
626 y0dst[2*x+0] += fill[2];
627 y0dst[2*x+1] += fill[3];
629 }
else if (pos == 2) {
630 y1dst[2*x+0] += fill[0];
631 y1dst[2*x+1] += fill[1];
640 y0dst -= 2*ylinesize;
641 y1dst -= 2*ylinesize;
662 int runlen,
y = 0,
x = 0;
667 code = bytestream2_peek_le32(gbyte);
668 runlen =
code & 0xFFFFFF;
670 if (
code >> 24 == 0x77) {
673 for (
int i = 0;
i < 4;
i++)
674 fill[
i] = bytestream2_get_byte(gbyte);
679 for (
int i = 0;
i < 4;
i++) {
682 if (
x >= frame->
width * 3) {
692 for (
int i = 0;
i < 4;
i++)
693 fill[
i] = bytestream2_get_byte(gbyte);
695 for (
int i = 0;
i < 4;
i++) {
698 if (
x >= frame->
width * 3) {
718 int runlen,
y = 0,
x = 0,
pos = 0;
723 code = bytestream2_peek_le32(gbyte);
724 runlen =
code & 0xFFFFFF;
726 if (
code >> 24 == 0x77) {
729 for (
int i = 0;
i < 4;
i++)
730 fill[
i] = bytestream2_get_byte(gbyte);
745 for (
int i = 0;
i < 4;
i++)
746 fill[
i] = bytestream2_get_byte(gbyte);
768 uint8_t ly0 = 0, ly1 = 0, ly2 = 0, ly3 = 0, lu = 0, lv = 0;
771 for (
int x = 0;
x < avctx->
width / 2;
x++) {
772 y0dst[
x*2+0] = bytestream2_get_byte(gbyte) + ly0;
774 y0dst[
x*2+1] = bytestream2_get_byte(gbyte) + ly1;
776 y1dst[
x*2+0] = bytestream2_get_byte(gbyte) + ly2;
778 y1dst[
x*2+1] = bytestream2_get_byte(gbyte) + ly3;
780 udst[
x] = bytestream2_get_byte(gbyte) + lu;
782 vdst[
x] = bytestream2_get_byte(gbyte) + lv;
847 for (
int i = 0;
i < nb_mvs;
i++) {
855 for (
int i = 0;
i < nb_mvs;
i++) {
920 if (idx < 256 && idx >= 0) {
922 }
else if (idx >= 0) {
923 get_tree_codes(codes, nodes, nodes[idx].child[0], pfx + (0 << bitpos), bitpos + 1);
924 get_tree_codes(codes, nodes, nodes[idx].child[1], pfx + (1
U << bitpos), bitpos + 1);
930 int zlcount = 0, curlen, idx, nindex, last, llast;
931 int blcounts[32] = { 0 };
937 for (
int i = 0;
i < 256;
i++) {
938 int bitlen = bitlens[
i];
939 int blcount = blcounts[bitlen];
941 zlcount += bitlen < 1;
942 syms[(bitlen << 8) + blcount] =
i;
946 for (
int i = 0;
i < 512;
i++) {
951 for (
int i = 0;
i < 256;
i++) {
952 node_idx[
i] = 257 +
i;
960 for (curlen = 1; curlen < 32; curlen++) {
961 if (blcounts[curlen] > 0) {
962 int max_zlcount = zlcount + blcounts[curlen];
964 for (
int i = 0; zlcount < 256 && zlcount < max_zlcount; zlcount++,
i++) {
965 int p = node_idx[nindex - 1 + 512];
966 int ch = syms[256 * curlen +
i];
971 if (nodes[p].child[0] == -1) {
986 p = node_idx[nindex - 1 + 512];
988 if (nodes[p].child[0] == -1) {
1000 for (
int i = 0;
i < idx;
i++)
1001 node_idx[512 +
i] = old_idx[
i];
1015 uint32_t new_codes[256];
1018 uint32_t codes[256];
1025 for (
int i = 0;
i < 256;
i++) {
1027 bits[nb_codes] = bitlen[
i];
1028 codes[nb_codes] = new_codes[
i];
1029 symbols[nb_codes] =
i;
1068 for (
int i = 0;
i < count;
i++)
1071 for (
int i = 0;
i < 256;
i++) {
1076 for (
int i = 0;
i < 256;
i++)
1102 unsigned compressed_size;
1111 header = bytestream2_get_le32(gbyte);
1112 s->
fflags = bytestream2_get_le32(gbyte);
1139 }
else if (!s->
dct) {
1145 w = bytestream2_get_le32(gbyte);
1146 h = bytestream2_get_le32(gbyte);
1147 if (w == INT32_MIN || h == INT32_MIN)
1158 width = avctx->
width;
1160 if (w < width || h < height || w & 7 || h & 7)
1173 for (
int i = 0;
i < 3;
i++)
1174 s->
size[
i] = bytestream2_get_le32(gbyte);
1179 compressed_size = avpkt->
size;
1182 if (s->
size[0] < 0 || s->
size[1] < 0 || s->
size[2] < 0 ||
1183 skip + s->
size[0] + s->
size[1] + s->
size[2] > compressed_size) {
1194 else if (!s->
dct && s->
rgb)
1203 if (!(s->
flags & 2)) {
1211 }
else if (!s->
dct && !s->
rgb) {
1245 if (!s->
rgb && !s->
dct) {
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int decode_runlen(AVCodecContext *avctx, GetByteContext *gbyte, AVFrame *frame)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int shift(int a, int b)
This structure describes decoded (raw) audio or video data.
static void flush(AVCodecContext *avctx)
int coded_width
Bitstream width / height, may be different from width/height e.g.
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 build_huff(const uint8_t *bitlen, VLC *vlc)
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)
static int read_code(GetBitContext *gb, int *oskip, int *level, int *map, int mode)
static int decode_runlen_rgb(AVCodecContext *avctx, GetByteContext *gbyte, AVFrame *frame)
static int decode_huffman2(AVCodecContext *avctx, int header, int size)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int chroma_quant_matrix[64]
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 AV_INPUT_BUFFER_PADDING_SIZE at the end w...
static void copy_block8(uint8_t *dst, const uint8_t *src, ptrdiff_t dstStride, ptrdiff_t srcStride, int h)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static int make_new_tree(const uint8_t *bitlens, uint32_t *codes)
static double cb(void *priv, double x, double y)
static int decode_inter(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame, AVFrame *prev)
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
#define u(width, name, range_min, range_max)
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
static int get_bits_count(const GetBitContext *s)
bitstream reader API header.
static int decode_inter_blocks(AGMContext *s, GetBitContext *gb, const int *quant_matrix, int *skip, int *map)
static const uint8_t header[24]
static av_cold int decode_init(AVCodecContext *avctx)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
static int get_bits_left(GetBitContext *gb)
static int decode_intra_plane(AGMContext *s, GetBitContext *gb, int size, const int *quant_matrix, AVFrame *frame, int plane)
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int decode_raw_intra_rgb(AVCodecContext *avctx, GetByteContext *gbyte, AVFrame *frame)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int decode_raw_intra(AVCodecContext *avctx, GetByteContext *gbyte, AVFrame *frame)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * name
Name of the codec implementation.
unsigned padded_output_size
static const uint8_t offset[127][2]
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&HAVE_MMX) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out-> ch ch
static av_cold int decode_close(AVCodecContext *avctx)
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
#define FF_CODEC_CAP_EXPORTS_CROPPING
The decoder sets the cropping fields in the output frames manually.
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame.
static int decode_intra_blocks(AGMContext *s, GetBitContext *gb, const int *quant_matrix, int *skip, int *dc_level)
int width
picture width / height.
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
static int fill_pixels(uint8_t **y0, uint8_t **y1, uint8_t **u, uint8_t **v, int ylinesize, int ulinesize, int vlinesize, uint8_t *fill, int *nx, int *ny, int *np, int w, int h)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
void(* idct_add)(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size, const int *quant_matrix, AVFrame *frame, AVFrame *prev, int plane)
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.
packed RGB 8:8:8, 24bpp, BGRBGR...
static void get_tree_codes(uint32_t *codes, Node *nodes, int idx, uint32_t pfx, int bitpos)
void(* idct_put)(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
block -> idct -> clip to unsigned 8 bit -> dest.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
static const uint8_t unscaled_luma[64]
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Describe the class of an AVClass context structure.
static void skip_bits(GetBitContext *s, int n)
static int decode_motion_vectors(AVCodecContext *avctx, GetBitContext *gb)
static const uint8_t unscaled_chroma[64]
const uint8_t ff_zigzag_direct[64]
const VDPAUPixFmtMap * map
static void compute_quant_matrix(AGMContext *s, double qscale)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
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.
static int decode_inter_block(AGMContext *s, GetBitContext *gb, const int *quant_matrix, int *skip, int *map)
static int decode_intra_block(AGMContext *s, GetBitContext *gb, const int *quant_matrix, int *skip, int *dc_level)
int luma_quant_matrix[64]
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)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
VLC_TYPE(* table)[2]
code, bits
int key_frame
1 -> keyframe, 0-> not
static const uint8_t * align_get_bits(GetBitContext *s)
static void decode_flush(AVCodecContext *avctx)
void(* idct)(int16_t *block)
#define MKTAG(a, b, c, d)
static double val(void *priv, double ch)
This structure stores compressed data.
static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame)
void ff_free_vlc(VLC *vlc)
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
mode
Use these values in ebur128_init (or'ed).
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
void(* add_pixels_clamped)(const int16_t *block, uint8_t *av_restrict pixels, ptrdiff_t line_size)