Go to the documentation of this file.
92 const uint8_t codes_counts[16],
93 const uint8_t **syms,
int offset)
99 vlc->
table = &vlc_buf[*buf_offset];
102 for (
int i = 16;
i > 0;
i--)
103 for (
unsigned tmp = num + codes_counts[
i - 1]; num <
tmp; num++)
124 for (
int i = 0;
i < 2;
i++){
133 &q_syms, -48 - 16 *
i);
134 for (
int j = 0; j < 4; j++)
136 &q_syms, -((8 << j) - 1));
152 memset(
c->oldDSCF, 0,
sizeof(
c->oldDSCF));
160 if (
c->maxbands >=
BANDS) {
182 int *got_frame_ptr,
AVPacket *avpkt)
184 const uint8_t *buf = avpkt->
data;
185 int buf_size = avpkt->
size;
188 int i, j, k, ch, cnt, res, t;
191 int maxband, keyframe;
194 keyframe =
c->cur_frame == 0;
197 memset(
c->Q, 0,
sizeof(
c->Q));
198 c->last_bits_used = 0;
209 if(maxband > 32) maxband -= 33;
217 if(maxband >
c->maxbands + 1) {
221 c->last_max_band = maxband;
225 last[0] = last[1] = 0;
226 for(
i = maxband - 1;
i >= 0;
i--){
227 for(ch = 0; ch < 2; ch++){
229 if(last[ch] > 15) last[ch] -= 17;
230 bands[
i].res[ch] = last[ch];
237 for(
i = 0;
i < maxband;
i++)
242 for(
i = maxband - 1;
i >= 0;
i--)
249 for(
i = maxband;
i <
c->maxbands;
i++)
253 for(
i = 0;
i < 32;
i++)
254 c->oldDSCF[0][
i] =
c->oldDSCF[1][
i] = 1;
257 for(
i = 0;
i < maxband;
i++){
268 for(
i = 0;
i < maxband;
i++){
269 for(ch = 0; ch < 2; ch++){
270 if(!
bands[
i].res[ch])
continue;
272 if(
c->oldDSCF[ch][
i]){
274 c->oldDSCF[ch][
i] = 0;
279 bands[
i].scf_idx[ch][0] = ((
bands[
i].scf_idx[ch][2] + t - 25) & 0x7F) - 6;
281 for(j = 0; j < 2; j++){
282 if((
bands[
i].scfi[ch] << j) & 2)
288 bands[
i].scf_idx[ch][j + 1] = ((
bands[
i].scf_idx[ch][j] + t - 25) & 0x7F) - 6;
295 for(ch = 0; ch < 2; ch++){
300 c->Q[ch][off + j] = (
av_lfg_get(&
c->rnd) & 0x3FC) - 510;
327 c->Q[ch][off + j + 1] = t >> 4;
339 cnt = (cnt >> 1) +
FFABS(
c->Q[ch][off + j]);
346 c->Q[ch][off + j] <<= res - 9;
347 c->Q[ch][off + j] |=
get_bits(gb, res - 9);
349 c->Q[ch][off + j] -= (1 << (res - 2)) - 1;
360 (int16_t **)
frame->extended_data,
366 if(
c->cur_frame >=
c->frames)
370 c->last_bits_used = buf_size << 3;
372 c->last_bits_used = buf_size << 3;
377 return c->cur_frame ?
c->last_bits_used >> 3 : buf_size;
static av_cold void mpc8_init_static(void)
int ff_vlc_init_from_lengths(VLC *vlc, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx)
Build VLC decoding tables suitable for use with get_vlc2()
static int get_bits_left(GetBitContext *gb)
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static av_cold void mpc8_decode_flush(AVCodecContext *avctx)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static const uint8_t mpc8_dscf_len_counts[2][16]
static int get_bits_count(const GetBitContext *s)
av_cold void ff_mpadsp_init(MPADSPContext *s)
static int mpc8_dec_base(GetBitContext *gb, int k, int n)
This structure describes decoded (raw) audio or video data.
static const uint16_t table[]
int nb_channels
Number of channels in this layout.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold void build_vlc(VLC *vlc, unsigned *buf_offset, const uint8_t codes_counts[16], const uint8_t **syms, int offset)
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
static int mpc8_get_mod_golomb(GetBitContext *gb, int m)
static int mpc8_get_mask(GetBitContext *gb, int size, int t)
void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, int16_t **out, int channels)
static const uint8_t mpc8_q2_len_counts[2][16]
static const uint8_t mpc8_scfi_len_counts[2][16]
static const uint32_t mpc8_cnk_lost[16][33]
static const uint8_t mpc8_cnk_len[16][33]
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
static const uint8_t mpc8_q5_8_len_counts[2][4][16]
static int ff_thread_once(char *control, void(*routine)(void))
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define FF_CODEC_DECODE_CB(func)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
static const int8_t mpc8_idx52[125]
static const float bands[]
#define CODEC_LONG_NAME(str)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static const uint8_t mpc8_bands_len_counts[16]
static const uint8_t mpc8_q1_len_counts[16]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
void ff_mpa_synth_init_fixed(void)
const FFCodec ff_mpc8_decoder
static unsigned int get_bits1(GetBitContext *s)
static const int8_t mpc8_huffq2[5 *5 *5]
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
static VLC quant_vlc[4][2]
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
static const uint8_t mpc8_q34_len_counts[2][16]
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
static const unsigned int mpc8_thres[]
static const uint8_t mpc8_bands_syms[MPC8_BANDS_SIZE]
static const uint8_t mpc8_q_syms[]
enum AVSampleFormat sample_fmt
audio sample format
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
static const uint32_t mpc8_cnk[16][32]
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
#define i(width, name, range_min, range_max)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
static const uint8_t mpc8_res_syms[]
AVSampleFormat
Audio sample formats.
static int mpc8_dec_enum(GetBitContext *gb, int k, int n)
static const uint8_t mpc8_dscf_syms[]
const char * name
Name of the codec implementation.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
static av_cold int mpc8_decode_init(AVCodecContext *avctx)
main external API structure.
#define VLC_INIT_STATIC_OVERLONG
static const uint8_t mpc8_res_len_counts[2][16]
Subband structure - hold all variables for each subband.
static const int8_t mpc8_idx50[125]
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
static av_const int sign_extend(int val, unsigned bits)
static const uint8_t mpc8_q9up_len_counts[16]
#define avpriv_request_sample(...)
This structure stores compressed data.
#define MPC8_MAX_VLC_SIZE
static const uint8_t mpc8_scfi_syms[]
static const int8_t mpc8_idx51[125]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int mpc8_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)