Go to the documentation of this file.
32 const uint8_t *
a = p + 4 - ((intptr_t)p & 3);
34 for (
end -= 3; p <
a && p <
end; p++) {
35 if (p[0] == 0 && p[1] == 0 && p[2] == 1)
39 for (
end -= 3; p <
end; p += 4) {
40 uint32_t
x = *(
const uint32_t*)p;
43 if ((
x - 0x01010101) & (~
x) & 0x80808080) {
45 if (p[0] == 0 && p[2] == 1)
47 if (p[2] == 0 && p[3] == 1)
51 if (p[2] == 0 && p[4] == 1)
53 if (p[4] == 0 && p[5] == 1)
59 for (
end += 3; p <
end; p++) {
60 if (p[0] == 0 && p[1] == 0 && p[2] == 1)
77 const uint8_t *nal_start, *nal_end;
82 while (nal_start <
end && !*(nal_start++));
88 avio_write(pb, nal_start, nal_end - nal_start);
89 size += 4 + nal_end - nal_start;
113 uint32_t sps_size = 0, pps_size = 0, sps_ext_size = 0;
114 int ret, nb_sps = 0, nb_pps = 0, nb_sps_ext = 0;
143 while (
end - buf > 4) {
148 nal_type = buf[0] & 0x1f;
158 }
else if (nal_type == 8) {
166 }
else if (nal_type == 13) {
168 if (
size > UINT16_MAX || nb_sps_ext >= 256) {
182 if (sps_size < 6 || !pps_size) {
198 if (
sps[3] != 66 &&
sps[3] != 77 &&
sps[3] != 88) {
224 uint16_t sps_size, pps_size;
231 if (*
size < 11 ||
in[0] != 1)
235 if (11 + sps_size > *
size)
238 if (11 + sps_size + pps_size > *
size)
245 memcpy(
out + 4, &
in[8], sps_size);
247 memcpy(
out + 8 + sps_size, &
in[11 + sps_size], pps_size);
257 unsigned int res = 0;
259 if (
end - start < nal_length_size)
261 while (nal_length_size--)
262 res = (res << 8) | *start++;
264 if (res >
end - start)
271 uint32_t *dst_len,
int header_len)
282 while (
i < header_len &&
i < src_len)
285 while (
i + 2 < src_len)
332 return ((v >> 1) ^ sign) - sign;
337 int i, j,
ret, rbsp_size, aspect_ratio_idc, pic_order_cnt_type;
338 int num_ref_frames_in_pic_order_cnt_cycle;
339 int delta_scale, lastScale = 8, nextScale = 8;
340 int sizeOfScalingList;
368 if (
sps->profile_idc == 100 ||
sps->profile_idc == 110 ||
369 sps->profile_idc == 122 ||
sps->profile_idc == 244 ||
sps->profile_idc == 44 ||
370 sps->profile_idc == 83 ||
sps->profile_idc == 86 ||
sps->profile_idc == 118 ||
371 sps->profile_idc == 128 ||
sps->profile_idc == 138 ||
sps->profile_idc == 139 ||
372 sps->profile_idc == 134) {
374 if (
sps->chroma_format_idc == 3) {
381 for (
i = 0;
i < ((
sps->chroma_format_idc != 3) ? 8 : 12);
i++) {
386 sizeOfScalingList =
i < 6 ? 16 : 64;
387 for (j = 0; j < sizeOfScalingList; j++) {
388 if (nextScale != 0) {
390 nextScale = (lastScale + delta_scale) & 0xff;
392 lastScale = nextScale == 0 ? lastScale : nextScale;
397 sps->chroma_format_idc = 1;
398 sps->bit_depth_luma = 8;
399 sps->bit_depth_chroma = 8;
405 if (pic_order_cnt_type == 0) {
407 }
else if (pic_order_cnt_type == 1) {
412 for (
i = 0;
i < num_ref_frames_in_pic_order_cnt_cycle;
i++)
422 if (!
sps->frame_mbs_only_flag)
436 aspect_ratio_idc =
get_bits(&gb, 8);
437 if (aspect_ratio_idc == 0xff) {
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
static av_cold int end(AVCodecContext *avctx)
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
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 please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
static int get_se_golomb(GetBitContext *gb)
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
uint8_t * ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len, uint32_t *dst_len, int header_len)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static const AVRational avc_sample_aspect_ratio[17]
Rational number (pair of numerator and denominator).
static int get_ue_golomb(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
void avio_w8(AVIOContext *s, int b)
int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
static int FUNC() pps(CodedBitstreamContext *ctx, RWContext *rw, H264RawPPS *current)
int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wb32(AVIOContext *s, unsigned int val)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
static const uint8_t * ff_avc_find_startcode_internal(const uint8_t *p, const uint8_t *end)
static void skip_bits1(GetBitContext *s)
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_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
#define i(width, name, range_min, range_max)
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
#define AV_INPUT_BUFFER_PADDING_SIZE
#define FF_ARRAY_ELEMS(a)
H264SequenceParameterSet * ff_avc_decode_sps(const uint8_t *buf, int buf_size)
int ff_avc_write_annexb_extradata(const uint8_t *in, uint8_t **buf, int *size)
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
void avio_wb16(AVIOContext *s, unsigned int val)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const uint8_t * ff_avc_mp4_find_startcode(const uint8_t *start, const uint8_t *end, int nal_length_size)
uint8_t chroma_format_idc
const uint8_t * ff_avc_find_startcode(const uint8_t *p, const uint8_t *end)