Go to the documentation of this file.
69 #define ENCODE(type, endian, src, dst, n, shift, offset) \
70 samples_ ## type = (const type *) src; \
71 for (; n > 0; n--) { \
72 register type v = (*samples_ ## type++ >> shift) + offset; \
73 bytestream_put_ ## endian(&dst, v); \
76 #define ENCODE_PLANAR(type, endian, dst, n, shift, offset) \
77 n /= avctx->channels; \
78 for (c = 0; c < avctx->channels; c++) { \
80 samples_ ## type = (const type *) frame->extended_data[c]; \
81 for (i = n; i > 0; i--) { \
82 register type v = (*samples_ ## type++ >> shift) + offset; \
83 bytestream_put_ ## endian(&dst, v); \
90 int n,
c, sample_size, v,
ret;
94 const int16_t *samples_int16_t;
96 const int64_t *samples_int64_t;
97 const uint16_t *samples_uint16_t;
98 const uint32_t *samples_uint32_t;
135 bytestream_put_be24(&dst,
tmp);
196 memcpy(dst,
samples, n * sample_size);
254 for (
i = 0;
i < 256;
i++)
258 for (
i = 0;
i < 256;
i++)
262 for (
i = 0;
i < 256;
i++)
306 #define DECODE(size, endian, src, dst, n, shift, offset) \
307 for (; n > 0; n--) { \
308 uint ## size ## _t v = bytestream_get_ ## endian(&src); \
309 AV_WN ## size ## A(dst, (uint ## size ## _t)(v - offset) << shift); \
313 #define DECODE_PLANAR(size, endian, src, dst, n, shift, offset) \
314 n /= avctx->channels; \
315 for (c = 0; c < avctx->channels; c++) { \
317 dst = frame->extended_data[c]; \
318 for (i = n; i > 0; i--) { \
319 uint ## size ## _t v = bytestream_get_ ## endian(&src); \
320 AV_WN ## size ## A(dst, (uint ## size ##_t)(v - offset) << shift); \
326 int *got_frame_ptr,
AVPacket *avpkt)
329 int buf_size = avpkt->
size;
332 int sample_size,
c, n,
ret, samples_per_block;
339 samples_per_block = 1;
342 samples_per_block = 2;
346 if (sample_size == 0) {
363 if (n && buf_size % n) {
366 "Invalid PCM packet, data has size %d but at least a size of %d was expected\n",
370 buf_size -= buf_size % n;
373 n = buf_size / sample_size;
405 uint32_t v = bytestream_get_be24(&
src);
427 for (
i = n;
i > 0;
i--)
510 *dst_int32_t++ = ((uint32_t)
src[2]<<28) |
513 ((
src[2] & 0x0F) << 8) |
516 *dst_int32_t++ = ((uint32_t)
src[4]<<24) |
518 ((
src[2] & 0xF0) << 8) |
532 s->fdsp->vector_fmul_scalar((
float *)
frame->extended_data[0],
533 (
const float *)
frame->extended_data[0],
543 #define PCM_ENCODER_0(id_, sample_fmt_, name_, long_name_)
544 #define PCM_ENCODER_1(id_, sample_fmt_, name_, long_name_) \
545 AVCodec ff_ ## name_ ## _encoder = { \
547 .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
548 .type = AVMEDIA_TYPE_AUDIO, \
549 .id = AV_CODEC_ID_ ## id_, \
550 .init = pcm_encode_init, \
551 .encode2 = pcm_encode_frame, \
552 .capabilities = AV_CODEC_CAP_VARIABLE_FRAME_SIZE, \
553 .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
554 AV_SAMPLE_FMT_NONE }, \
557 #define PCM_ENCODER_2(cf, id, sample_fmt, name, long_name) \
558 PCM_ENCODER_ ## cf(id, sample_fmt, name, long_name)
559 #define PCM_ENCODER_3(cf, id, sample_fmt, name, long_name) \
560 PCM_ENCODER_2(cf, id, sample_fmt, name, long_name)
561 #define PCM_ENCODER(id, sample_fmt, name, long_name) \
562 PCM_ENCODER_3(CONFIG_ ## id ## _ENCODER, id, sample_fmt, name, long_name)
564 #define PCM_DECODER_0(id, sample_fmt, name, long_name)
565 #define PCM_DECODER_1(id_, sample_fmt_, name_, long_name_) \
566 AVCodec ff_ ## name_ ## _decoder = { \
568 .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
569 .type = AVMEDIA_TYPE_AUDIO, \
570 .id = AV_CODEC_ID_ ## id_, \
571 .priv_data_size = sizeof(PCMDecode), \
572 .init = pcm_decode_init, \
573 .close = pcm_decode_close, \
574 .decode = pcm_decode_frame, \
575 .capabilities = AV_CODEC_CAP_DR1, \
576 .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \
577 AV_SAMPLE_FMT_NONE }, \
580 #define PCM_DECODER_2(cf, id, sample_fmt, name, long_name) \
581 PCM_DECODER_ ## cf(id, sample_fmt, name, long_name)
582 #define PCM_DECODER_3(cf, id, sample_fmt, name, long_name) \
583 PCM_DECODER_2(cf, id, sample_fmt, name, long_name)
584 #define PCM_DECODER(id, sample_fmt, name, long_name) \
585 PCM_DECODER_3(CONFIG_ ## id ## _DECODER, id, sample_fmt, name, long_name)
587 #define PCM_CODEC(id, sample_fmt_, name, long_name_) \
588 PCM_ENCODER(id, sample_fmt_, name, long_name_); \
589 PCM_DECODER(id, sample_fmt_, name, long_name_)
int frame_size
Number of samples per channel in an audio frame.
#define PCM_CODEC(id, sample_fmt_, name, long_name_)
static uint8_t linear_to_alaw[16384]
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define ENCODE(type, endian, src, dst, n, shift, offset)
Write PCM samples macro.
static av_cold int pcm_decode_close(AVCodecContext *avctx)
static void pcm_ulaw_tableinit(void)
int sample_rate
samples per second
static av_cold int vidc2linear(unsigned char u_val)
@ AV_CODEC_ID_PCM_S32LE_PLANAR
This structure describes decoded (raw) audio or video data.
static void pcm_alaw_tableinit(void)
@ AV_CODEC_ID_PCM_S16BE_PLANAR
const uint8_t ff_reverse[256]
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new samples
@ AV_CODEC_ID_PCM_S16LE_PLANAR
const struct AVCodec * codec
enum AVSampleFormat * sample_fmts
array of supported sample formats, or NULL if unknown, array is terminated by -1
#define PCM_DECODER(id, sample_fmt, name, long_name)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static uint8_t linear_to_ulaw[16384]
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int64_t bit_rate
the average bitrate
#define DECODE_PLANAR(size, endian, src, dst, n, shift, offset)
static av_cold int pcm_decode_init(AVCodecContext *avctx)
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
@ AV_CODEC_ID_PCM_S24LE_PLANAR
static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
static av_cold int alaw2linear(unsigned char a_val)
enum AVSampleFormat sample_fmt
audio sample format
#define DECODE(size, endian, src, dst, n, shift, offset)
Read PCM samples macro.
static void pcm_vidc_tableinit(void)
#define ENCODE_PLANAR(type, endian, dst, n, shift, offset)
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
int channels
number of audio channels
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
#define i(width, name, range_min, range_max)
@ AV_SAMPLE_FMT_S16
signed 16 bits
static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, uint8_t *dst, unsigned int size)
static int pcm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
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 uint8_t linear_to_vidc[16384]
main external API structure.
@ AV_CODEC_ID_PCM_S24DAUD
static av_cold int pcm_encode_init(AVCodecContext *avctx)
This structure stores compressed data.
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
@ AV_CODEC_ID_PCM_S8_PLANAR
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
@ AV_SAMPLE_FMT_DBL
double
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
@ AV_SAMPLE_FMT_S32
signed 32 bits
static av_cold int ulaw2linear(unsigned char u_val)
@ AV_SAMPLE_FMT_S64
signed 64 bits