61 #define OFFSET(x) offsetof(MPTestContext, x)
62 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
93 for (i = 0; i < 8; i++) {
94 double s = i == 0 ? sqrt(0.125) : 0.5;
96 for (j = 0; j < 8; j++)
97 c[i*8+j] = s*cos((
M_PI/8.0)*i*(j+0.5));
106 for (i = 0; i < 8; i++) {
107 for (j = 0; j < 8; j++) {
110 for (k = 0; k < 8; k++)
111 sum +=
c[k*8+j] * src[8*i+k];
117 for (j = 0; j < 8; j++) {
118 for (i = 0; i < 8; i++) {
121 for (k = 0; k < 8; k++)
122 sum +=
c[k*8+i]*tmp[8*k+j];
124 dst[dst_linesize*i + j] = av_clip_uint8(
lrint(sum));
133 for (y = 0; y <
h; y++)
134 for (x = 0; x < w; x++)
135 dst[x + y*dst_linesize] = color;
142 memset(src, 0, 64*
sizeof(
int));
146 idct(dst, dst_linesize, src);
151 if (cbp&1)
draw_basis(dst[0] , dst_linesize[0], amp, 1, dc);
152 if (cbp&2)
draw_basis(dst[0]+8 , dst_linesize[0], amp, 1, dc);
153 if (cbp&4)
draw_basis(dst[0]+ 8*dst_linesize[0], dst_linesize[0], amp, 1, dc);
154 if (cbp&8)
draw_basis(dst[0]+8+8*dst_linesize[0], dst_linesize[0], amp, 1, dc);
155 if (cbp&16)
draw_basis(dst[1] , dst_linesize[1], amp, 1, dc);
156 if (cbp&32)
draw_basis(dst[2] , dst_linesize[2], amp, 1, dc);
161 const int step =
FFMAX(256/(w*h/256), 1);
162 int x, y,
color = off;
164 for (y = 0; y <
h; y += 16) {
165 for (x = 0; x < w; x += 16) {
166 draw_dc(dst + x + y*dst_linesize, dst_linesize, color, 8, 8);
176 for (y = 0; y < 8*16; y += 16) {
177 for (x = 0; x < 8*16; x += 16) {
178 draw_basis(dst + x + y*dst_linesize, dst_linesize, 4*(96+off), freq, 128*8);
188 for (y = 0; y < 16*16; y += 16) {
189 for (x = 0; x < 16*16; x += 16) {
190 draw_basis(dst + x + y*dst_linesize, dst_linesize, 4*amp, 1, 128*8);
200 for (y = 0; y < 16*8; y += 16) {
201 for (x = 0; x < 16*8; x += 16) {
203 dst1[0] = dst[0] + x*2 + y*2*dst_linesize[0];
204 dst1[1] = dst[1] + x + y* dst_linesize[1];
205 dst1[2] = dst[2] + x + y* dst_linesize[2];
207 draw_cbp(dst1, dst_linesize, cbp, (64+off)*4, 128*8);
217 for (y = 0; y < 16*16; y++) {
220 for (x = 0; x < 16*16; x++)
221 dst[x + y*dst_linesize] = x + off*8/(y/32+1);
229 for (y = off; y < 16*16; y += 16) {
230 for (x = off; x < 16*16; x += 16) {
231 draw_dc(dst + x + y*dst_linesize, dst_linesize, ((x+y)&16) ? color : -color, 16, 16);
241 for (y = 0; y < 16*16; y++) {
242 for (x = 0; x < 16*16; x++) {
243 double d =
hypot(x-8*16, y-8*16);
244 double r = d/20 - (int)(d/20);
246 dst[x + y*dst_linesize] = 255;
247 dst[x + y*dst_linesize+256] = 0;
249 dst[x + y*dst_linesize] = x;
250 dst[x + y*dst_linesize+256] = x;
315 picref->
pts = test->
pts++;
318 for (i = 0; i <
h; i++)
320 for (i = 0; i < ch; i++) {
321 memset(picref->
data[1] + i*picref->
linesize[1], 128, cw);
322 memset(picref->
data[2] + i*picref->
linesize[2], 128, cw);
358 .priv_class = &mptestsrc_class,
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
static int config_props(AVFilterLink *outlink)
Main libavfilter public API header.
int h
agreed upon image height
static void init_idct(void)
static av_cold int init(AVFilterContext *ctx)
static int request_frame(AVFilterLink *outlink)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static void dc_test(uint8_t *dst, int dst_linesize, int w, int h, int off)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
const char * name
Pad name.
static void cbp_test(uint8_t *dst[3], int dst_linesize[3], int off)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static double av_q2d(AVRational a)
Convert rational to double.
#define AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
AVFILTER_DEFINE_CLASS(mptestsrc)
int w
agreed upon image width
static av_const double hypot(double x, double y)
static void test(const char *pattern, const char *host)
static void ring2_test(uint8_t *dst, int dst_linesize, int off)
static const AVFilterPad mptestsrc_outputs[]
AVFilterContext * src
source filter
static const AVFilterPad outputs[]
int format
agreed upon media format
static void mv_test(uint8_t *dst, int dst_linesize, int off)
static const AVFilterPad inputs[]
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
AVFilter ff_vsrc_mptestsrc
static int query_formats(AVFilterContext *ctx)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Describe the class of an AVClass context structure.
rational number numerator/denominator
offset must point to AVRational
const char * name
Filter name.
static void amp_test(uint8_t *dst, int dst_linesize, int off)
static enum AVPixelFormat pix_fmts[]
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static void draw_basis(uint8_t *dst, int dst_linesize, int amp, int freq, int dc)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static void draw_dc(uint8_t *dst, int dst_linesize, int color, int w, int h)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;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);returnNULL;}returnac;}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;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->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);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> dc
static void ring1_test(uint8_t *dst, int dst_linesize, int off)
static const AVOption mptestsrc_options[]
static void idct(uint8_t *dst, int dst_linesize, int src[64])
static void draw_cbp(uint8_t *dst[3], int dst_linesize[3], int cbp, int amp, int dc)
static void freq_test(uint8_t *dst, int dst_linesize, int off)
AVPixelFormat
Pixel format.
int64_t frame_count
Number of past frames sent through the link.
#define AV_CEIL_RSHIFT(a, b)