59#define OFFSET(x) offsetof(MPTestContext, x)
60#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
80 {
"max_frames",
"Set the maximum number of frames generated for each test",
OFFSET(max_frames),
82 {
"m",
"Set the maximum number of frames generated for each test",
OFFSET(max_frames),
95 for (
i = 0;
i < 8;
i++) {
96 double s =
i == 0 ? sqrt(0.125) : 0.5;
98 for (j = 0; j < 8; j++)
99 c[
i*8+j] =
s*cos((
M_PI/8.0)*
i*(j+0.5));
108 for (
i = 0;
i < 8;
i++) {
109 for (j = 0; j < 8; j++) {
112 for (k = 0; k < 8; k++)
113 sum +=
c[k*8+j] *
src[8*
i+k];
119 for (j = 0; j < 8; j++) {
120 for (
i = 0;
i < 8;
i++) {
123 for (k = 0; k < 8; k++)
124 sum +=
c[k*8+
i]*
tmp[8*k+j];
135 for (y = 0; y <
h; y++)
136 for (x = 0; x <
w; x++)
140static void draw_basis(uint8_t *
dst,
int dst_linesize,
int amp,
int freq,
int dc)
144 memset(
src, 0, 64*
sizeof(
int));
151static void draw_cbp(uint8_t *
dst[3],
int dst_linesize[3],
int cbp,
int amp,
int dc)
154 if (cbp&2)
draw_basis(
dst[0]+8 , dst_linesize[0], amp, 1, dc);
155 if (cbp&4)
draw_basis(
dst[0]+ 8*dst_linesize[0], dst_linesize[0], amp, 1, dc);
156 if (cbp&8)
draw_basis(
dst[0]+8+8*dst_linesize[0], dst_linesize[0], amp, 1, dc);
157 if (cbp&16)
draw_basis(
dst[1] , dst_linesize[1], amp, 1, dc);
158 if (cbp&32)
draw_basis(
dst[2] , dst_linesize[2], amp, 1, dc);
161static void dc_test(uint8_t *
dst,
int dst_linesize,
int w,
int h,
int off)
163 const int step =
FFMAX(256/(
w*
h/256), 1);
164 int x, y,
color = off;
166 for (y = 0; y <
h; y += 16) {
167 for (x = 0; x <
w; x += 16) {
178 for (y = 0; y < 8*16; y += 16) {
179 for (x = 0; x < 8*16; x += 16) {
180 draw_basis(
dst + x + y*dst_linesize, dst_linesize, 4*(96+off), freq, 128*8);
190 for (y = 0; y < 16*16; y += 16) {
191 for (x = 0; x < 16*16; x += 16) {
192 draw_basis(
dst + x + y*dst_linesize, dst_linesize, 4*amp, 1, 128*8);
198static void cbp_test(uint8_t *
dst[3],
int dst_linesize[3],
int off)
202 for (y = 0; y < 16*8; y += 16) {
203 for (x = 0; x < 16*8; x += 16) {
205 dst1[0] =
dst[0] + x*2 + y*2*dst_linesize[0];
206 dst1[1] =
dst[1] + x + y* dst_linesize[1];
207 dst1[2] =
dst[2] + x + y* dst_linesize[2];
209 draw_cbp(dst1, dst_linesize, cbp, (64+off)*4, 128*8);
219 for (y = 0; y < 16*16; y++) {
222 for (x = 0; x < 16*16; x++)
223 dst[x + y*dst_linesize] = x + off*8/(y/32+1);
231 for (y = off; y < 16*16; y += 16) {
232 for (x = off; x < 16*16; x += 16) {
243 for (y = 0; y < 16*16; y++) {
244 for (x = 0; x < 16*16; x++) {
245 double d =
hypot(x-8*16, y-8*16);
246 double r = d/20 - (int)(d/20);
248 dst[x + y*dst_linesize] = 255;
249 dst[x + y*dst_linesize+256] = 0;
251 dst[x + y*dst_linesize] = x;
252 dst[x + y*dst_linesize+256] = x;
262 test->max_pts =
test->duration >= 0 ?
267 test->frame_rate.num,
test->frame_rate.den,
313 for (
i = 0;
i <
h;
i++)
315 for (
i = 0;
i < ch;
i++) {
349 .p.name =
"mptestsrc",
351 .p.priv_class = &mptestsrc_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int request_frame(AVFilterLink *outlink)
const FFFilter ff_vsrc_mptestsrc
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
#define AV_CEIL_RSHIFT(a, b)
int(* init)(AVBSFContext *ctx)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
@ AV_OPT_TYPE_VIDEO_RATE
Underlying C type is AVRational.
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define FILTER_OUTPUTS(array)
static FilterLink * ff_filter_link(AVFilterLink *link)
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_const double hypot(double x, double y)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int config_props(AVBitStreamFilterLink *link)
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int64_t duration
Duration of the frame, in the same units as pts.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Rational number (pair of numerator and denominator).
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
int64_t frame_count_in
Number of past frames sent through the link.
static AVFormatContext * ctx
static int mod(int a, int b)
Modulo operation with only positive remainders.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static const AVOption mptestsrc_options[]
static void cbp_test(uint8_t *dst[3], int dst_linesize[3], int off)
static int config_props(AVFilterLink *outlink)
static void draw_cbp(uint8_t *dst[3], int dst_linesize[3], int cbp, int amp, int dc)
static void mv_test(uint8_t *dst, int dst_linesize, int off)
static void idct(uint8_t *dst, int dst_linesize, int src[64])
static void init_idct(void)
static void amp_test(uint8_t *dst, int dst_linesize, int off)
static void draw_dc(uint8_t *dst, int dst_linesize, int color, int w, int h)
static void freq_test(uint8_t *dst, int dst_linesize, int off)
static int request_frame(AVFilterLink *outlink)
static void dc_test(uint8_t *dst, int dst_linesize, int w, int h, int off)
static const AVFilterPad mptestsrc_outputs[]
static void draw_basis(uint8_t *dst, int dst_linesize, int amp, int freq, int dc)
static void ring1_test(uint8_t *dst, int dst_linesize, int off)
static void ring2_test(uint8_t *dst, int dst_linesize, int off)