30 #define BITSTREAM_READER_LE 37 #define FORMAT_SIMPLE 1 38 #define FORMAT_ENCRYPTED 2 49 uint32_t k0, k1, sum0,
sum1;
73 0x00000001, 0x00000002, 0x00000004, 0x00000008,
74 0x00000010, 0x00000020, 0x00000040, 0x00000080,
75 0x00000100, 0x00000200, 0x00000400, 0x00000800,
76 0x00001000, 0x00002000, 0x00004000, 0x00008000,
77 0x00010000, 0x00020000, 0x00040000, 0x00080000,
78 0x00100000, 0x00200000, 0x00400000, 0x00800000,
79 0x01000000, 0x02000000, 0x04000000, 0x08000000,
80 0x10000000, 0x20000000, 0x40000000, 0x80000000,
81 0x80000000, 0x80000000, 0x80000000, 0x80000000,
82 0x80000000, 0x80000000, 0x80000000, 0x80000000
118 sum += *dl++ * *
qm, qm++;
119 sum += *dl++ * *
qm, qm++;
120 sum += *dl++ * *
qm, qm++;
121 sum += *dl++ * *
qm, qm++;
122 sum += *dl++ * *
qm, qm++;
123 sum += *dl++ * *
qm, qm++;
124 sum += *dl++ * *
qm, qm++;
125 sum += *dl++ * *
qm, qm++;
127 }
else if(c->
error < 0) {
128 sum += *dl++ * (*
qm -= *
dx++), qm++;
129 sum += *dl++ * (*qm -= *
dx++), qm++;
130 sum += *dl++ * (*qm -= *
dx++), qm++;
131 sum += *dl++ * (*qm -= *
dx++), qm++;
132 sum += *dl++ * (*qm -= *
dx++), qm++;
133 sum += *dl++ * (*qm -= *
dx++), qm++;
134 sum += *dl++ * (*qm -= *
dx++), qm++;
135 sum += *dl++ * (*qm -= *
dx++), qm++;
137 sum += *dl++ * (*
qm += *
dx++), qm++;
138 sum += *dl++ * (*qm += *
dx++), qm++;
139 sum += *dl++ * (*qm += *
dx++), qm++;
140 sum += *dl++ * (*qm += *
dx++), qm++;
141 sum += *dl++ * (*qm += *
dx++), qm++;
142 sum += *dl++ * (*qm += *
dx++), qm++;
143 sum += *dl++ * (*qm += *
dx++), qm++;
144 sum += *dl++ * (*qm += *
dx++), qm++;
147 *(
dx-0) = ((*(dl-1) >> 30) | 1) << 2;
148 *(
dx-1) = ((*(dl-2) >> 30) | 1) << 1;
149 *(
dx-2) = ((*(dl-3) >> 30) | 1) << 1;
150 *(
dx-3) = ((*(dl-4) >> 30) | 1);
153 *in += (sum >> c->
shift);
156 *(dl-1) = *dl - *(dl-1);
157 *(dl-2) = *(dl-1) - *(dl-2);
158 *(dl-3) = *(dl-2) - *(dl-3);
188 if (CRC != (crc ^ 0xFFFFFFFFU)) {
309 int *got_frame_ptr,
AVPacket *avpkt)
313 int buf_size = avpkt->
size;
350 uint32_t unary, depth, k;
381 rice->
sum1 += value - (rice->
sum1 >> 4);
388 rice->
sum0 += value - (rice->
sum0 >> 4);
396 *p = 1 + ((value >> 1) ^ ((value & 1) - 1));
402 #define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k) 404 case 1: *p +=
PRED(*predictor, 4);
break;
406 case 3: *p +=
PRED(*predictor, 5);
break;
418 for (*p += *r / 2; r > p - s->
channels; r--)
440 int16_t *samples = (int16_t *)frame->
data[0];
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
static int tta_check_crc(TTAContext *s, const uint8_t *buf, int buf_size)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static void rice_init(TTARice *c, uint32_t k0, uint32_t k1)
This structure describes decoded (raw) audio or video data.
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
static void skip_bits_long(GetBitContext *s, int n)
static av_cold int tta_decode_init(AVCodecContext *avctx)
static int tta_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
static int tta_get_unary(GetBitContext *gb)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static av_cold int tta_decode_close(AVCodecContext *avctx)
static const uint32_t *const shift_16
enum AVSampleFormat sample_fmt
audio sample format
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
bitstream reader API header.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static void predictor(uint8_t *src, int size)
static int get_bits_left(GetBitContext *gb)
static const uint32_t shift_1[]
#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,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;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);return NULL;} return ac;} 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;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->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);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_dlog(ac->avr, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
#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.
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static void ttafilter_init(TTAFilter *c, int32_t shift)
static void ttafilter_process(TTAFilter *c, int32_t *in)
static void memshl(register int32_t *a, register int32_t *b)
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
Libavcodec external API header.
int sample_rate
samples per second
main external API structure.
static void close(AVCodecParserContext *s)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static unsigned int get_bits1(GetBitContext *s)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data...
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static const int32_t ttafilter_configs[4]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
static av_cold int init(AVCodecParserContext *s)
int channels
number of audio channels
static const uint8_t * align_get_bits(GetBitContext *s)
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...