Go to the documentation of this file.
55 #define OFFSET(x) offsetof(DatascopeContext, x)
56 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
80 int x0,
int y0,
const uint8_t *text,
int vertical)
84 for (; *text; text++) {
106 color->rgba[3] = 255;
109 for (
i = 0;
i < 4;
i++) {
114 value[p] =
in->data[p][(y >> draw->
vsub[p]) *
in->linesize[p] + (x >> draw->
hsub[p])];
124 color->rgba[3] = 255;
127 for (
i = 0;
i < 4;
i++) {
144 reverse->comp[p].u8[0] =
color->comp[p].u8[0] > 127 ? 0 : 255;
145 reverse->comp[p].u8[1] =
color->comp[p].u8[1] > 127 ? 0 : 255;
146 reverse->comp[p].u8[2] =
color->comp[p].u8[2] > 127 ? 0 : 255;
157 const unsigned mid = (
max + 1) / 2;
178 const int xoff =
td->xoff;
179 const int yoff =
td->yoff;
180 const int P =
FFMAX(
s->nb_planes,
s->nb_comps);
181 const int C =
s->chars;
182 const int W = (outlink->
w - xoff) / (
C * 10);
183 const int H = (outlink->
h - yoff) / (
P * 12);
184 const char *
format[2] = {
"%02X\n",
"%04X\n"};
185 const int slice_start = (
W * jobnr) / nb_jobs;
186 const int slice_end = (
W * (jobnr+1)) / nb_jobs;
189 for (y = 0; y <
H && (y +
s->y <
inlink->h); y++) {
193 int value[4] = { 0 };
198 xoff + x *
C * 10, yoff + y *
P * 12,
C * 10,
P * 12);
200 for (p = 0; p <
P; p++) {
220 const int xoff =
td->xoff;
221 const int yoff =
td->yoff;
222 const int P =
FFMAX(
s->nb_planes,
s->nb_comps);
223 const int C =
s->chars;
224 const int W = (outlink->
w - xoff) / (
C * 10);
225 const int H = (outlink->
h - yoff) / (
P * 12);
226 const char *
format[2] = {
"%02X\n",
"%04X\n"};
227 const int slice_start = (
W * jobnr) / nb_jobs;
228 const int slice_end = (
W * (jobnr+1)) / nb_jobs;
231 for (y = 0; y <
H && (y +
s->y <
inlink->h); y++) {
234 int value[4] = { 0 };
238 for (p = 0; p <
P; p++) {
242 draw_text(&
s->draw,
out, &
color, xoff + x *
C * 10 + 2, yoff + y *
P * 12 + p * 10 + 2, text, 0);
258 const int xoff =
td->xoff;
259 const int yoff =
td->yoff;
260 const int P =
FFMAX(
s->nb_planes,
s->nb_comps);
261 const int C =
s->chars;
262 const int W = (outlink->
w - xoff) / (
C * 10);
263 const int H = (outlink->
h - yoff) / (
P * 12);
264 const char *
format[2] = {
"%02X\n",
"%04X\n"};
265 const int slice_start = (
W * jobnr) / nb_jobs;
266 const int slice_end = (
W * (jobnr+1)) / nb_jobs;
269 for (y = 0; y <
H && (y +
s->y <
inlink->h); y++) {
272 int value[4] = { 0 };
275 for (p = 0; p <
P; p++) {
279 draw_text(&
s->draw,
out, &
s->white, xoff + x *
C * 10 + 2, yoff + y *
P * 12 + p * 10 + 2, text, 0);
305 0, 0, outlink->
w, outlink->
h);
308 const int P =
FFMAX(
s->nb_planes,
s->nb_comps);
309 const int C =
s->chars;
310 int Y = outlink->
h / (
P * 12);
311 int X = outlink->
w / (
C * 10);
312 char text[256] = { 0 };
316 ymaxlen = strlen(text);
318 snprintf(text,
sizeof(text),
"%d",
s->x + X);
319 xmaxlen = strlen(text);
322 Y = (outlink->
h - xmaxlen) / (
P * 12);
323 X = (outlink->
w - ymaxlen) / (
C * 10);
325 for (y = 0; y <
Y; y++) {
326 snprintf(text,
sizeof(text),
"%d",
s->y + y);
329 0, xmaxlen + y *
P * 12 + (
P + 1) *
P - 2, ymaxlen, 10);
331 draw_text(&
s->draw,
out, &
s->yellow, 2, xmaxlen + y *
P * 12 + (
P + 1) *
P, text, 0);
334 for (x = 0; x < X; x++) {
335 snprintf(text,
sizeof(text),
"%d",
s->x + x);
338 ymaxlen + x *
C * 10 + 2 *
C - 2, 0, 10, xmaxlen);
340 draw_text(&
s->draw,
out, &
s->yellow, ymaxlen + x *
C * 10 + 2 *
C, 2, text, 1);
344 td.in =
in;
td.out =
out,
td.yoff = xmaxlen,
td.xoff = ymaxlen;
362 s->chars = (
s->draw.desc->comp[0].depth + 7) / 8 * 2;
363 s->nb_comps =
s->draw.desc->nb_components;
371 if (
s->draw.desc->comp[0].depth <= 8) {
416 .priv_class = &datascope_class,
450 #define POFFSET(x) offsetof(PixscopeContext, x)
477 s->nb_comps =
s->draw.desc->nb_components;
481 s->colors[0] = &
s->red;
482 s->colors[1] = &
s->green;
483 s->colors[2] = &
s->blue;
484 s->colors[3] = &
s->white;
487 s->colors[0] = &
s->white;
488 s->colors[1] = &
s->blue;
489 s->colors[2] = &
s->red;
490 s->colors[3] = &
s->white;
497 if (
s->draw.desc->comp[0].depth <= 8) {
527 int max[4] = { 0 },
min[4] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX };
528 float average[4] = { 0 };
529 double rms[4] = { 0 };
530 const char rgba[4] = {
'R',
'G',
'B',
'A' };
531 const char yuva[4] = {
'Y',
'U',
'V',
'A' };
532 int x, y, X,
Y,
i,
w,
h;
546 X = (
in->width -
s->ww) *
s->wx;
548 X = (
in->width -
s->ww) * -
s->wx;
551 Y = (
in->height -
s->wh) *
s->wy;
553 Y = (
in->height -
s->wh) * -
s->wy;
557 if (
s->x +
s->w >= X && (
s->x +
s->w <= X +
s->ww) &&
558 s->y +
s->h >=
Y && (
s->y +
s->h <=
Y +
s->wh)) {
559 X = (
in->width -
s->ww) * (1 +
s->wx);
564 if (
s->x +
s->w >= X && (
s->x +
s->w <= X +
s->ww) &&
565 s->y +
s->h >=
Y && (
s->y +
s->h <=
Y +
s->wh)) {
566 Y = (
in->height -
s->wh) * (1 +
s->wy);
577 for (y = 0; y <
s->h; y++) {
578 for (x = 0; x <
s->w; x++) {
580 int value[4] = { 0 };
584 x *
w + (
s->ww - 4 - (
s->w *
w)) / 2 + X, y *
h + 2 +
Y,
w,
h);
585 for (
i = 0;
i < 4;
i++) {
596 s->x - 2,
s->y - 2,
s->w + 4, 1);
600 s->x - 1,
s->y - 1,
s->w + 2, 1);
604 s->x - 1,
s->y - 1, 1,
s->h + 2);
608 s->x - 2,
s->y - 2, 1,
s->h + 4);
612 s->x - 1,
s->y + 1 +
s->h,
s->w + 3, 1);
616 s->x - 2,
s->y + 2 +
s->h,
s->w + 4, 1);
620 s->x + 1 +
s->w,
s->y - 1, 1,
s->h + 2);
624 s->x + 2 +
s->w,
s->y - 2, 1,
s->h + 5);
626 for (
i = 0;
i < 4;
i++) {
627 rms[
i] /=
s->w *
s->h;
628 rms[
i] = sqrt(rms[
i]);
629 average[
i] /=
s->w *
s->h;
632 snprintf(text,
sizeof(text),
"CH AVG MIN MAX RMS\n");
634 for (
i = 0;
i <
s->nb_comps;
i++) {
635 int c =
s->rgba_map[
i];
637 snprintf(text,
sizeof(text),
"%c %07.1f %05d %05d %07.1f\n",
s->is_rgb ? rgba[
i] : yuva[
i], average[
c],
min[
c],
max[
c], rms[
c]);
667 .priv_class = &pixscope_class,
720 #define OOFFSET(x) offsetof(OscilloscopeContext, x)
751 int dx =
FFABS(
x1 - x0), sx = x0 <
x1 ? 1 : -1;
752 int dy =
FFABS(
y1 - y0), sy = y0 <
y1 ? 1 : -1;
753 int err = (dx > dy ? dx : -dy) / 2, e2;
757 if (x0 >= 0 && y0 >= 0 && x0 < out->
width && y0 < out->
height) {
761 for (
i = 0;
i < 4;
i++) {
769 for (
i = 0;
i < 4;
i++) {
779 if (x0 ==
x1 && y0 ==
y1)
800 for (
i = 1;
i <
s->nb_values;
i++) {
801 for (
c = 0;
c <
s->nb_comps;
c++) {
802 if ((1 <<
c) &
s->components) {
803 int x =
i *
s->width /
s->nb_values;
804 int px = (
i - 1) *
s->width /
s->nb_values;
805 int py =
s->height -
s->values[
i-1].p[
s->rgba_map[
c]] *
s->height / 256;
806 int y =
s->height -
s->values[
i].p[
s->rgba_map[
c]] *
s->height / 256;
819 for (
i = 1;
i <
s->nb_values;
i++) {
820 for (
c = 0;
c <
s->nb_comps;
c++) {
821 if ((1 <<
c) &
s->components) {
822 int x =
i *
s->width /
s->nb_values;
823 int px = (
i - 1) *
s->width /
s->nb_values;
824 int py =
s->height -
s->values[
i-1].p[
s->rgba_map[
c]] *
s->height /
s->max;
825 int y =
s->height -
s->values[
i].p[
s->rgba_map[
c]] *
s->height /
s->max;
850 s->nb_comps =
s->draw.desc->nb_components;
854 s->colors[0] = &
s->red;
855 s->colors[1] = &
s->green;
856 s->colors[2] = &
s->blue;
857 s->colors[3] = &
s->white;
860 s->colors[0] = &
s->white;
861 s->colors[1] = &
s->cyan;
862 s->colors[2] = &
s->magenta;
863 s->colors[3] = &
s->white;
870 if (
s->draw.desc->comp[0].depth <= 8) {
878 s->max = (1 <<
s->draw.desc->comp[0].depth);
879 cx =
s->xpos * (
inlink->w - 1);
880 cy =
s->ypos * (
inlink->h - 1);
904 int dx =
FFABS(
x1 - x0), sx = x0 <
x1 ? 1 : -1;
905 int dy =
FFABS(
y1 - y0), sy = y0 <
y1 ? 1 : -1;
906 int err = (dx > dy ? dx : -dy) / 2, e2;
909 if (x0 >= 0 && y0 >= 0 && x0 < out->
width && y0 < out->
height) {
911 int value[4] = { 0 };
914 s->values[
s->nb_values].p[0] =
value[0];
915 s->values[
s->nb_values].p[1] =
value[1];
916 s->values[
s->nb_values].p[2] =
value[2];
917 s->values[
s->nb_values].p[3] =
value[3];
921 if (
s->draw.desc->comp[0].depth == 8) {
922 if (
s->draw.nb_planes == 1) {
925 for (
i = 0;
i <
s->draw.pixelstep[0];
i++)
926 out->data[0][
out->linesize[0] * y0 + x0 *
s->draw.pixelstep[0] +
i] = 255 * ((
s->nb_values +
state) & 1);
928 out->data[0][
out->linesize[0] * y0 + x0] = 255 * ((
s->nb_values +
state) & 1);
931 if (
s->draw.nb_planes == 1) {
934 for (
i = 0;
i <
s->draw.pixelstep[0];
i++)
935 AV_WN16(
out->data[0] +
out->linesize[0] * y0 + 2 * x0 * (
s->draw.pixelstep[0] +
i), (
s->max - 1) * ((
s->nb_values +
state) & 1));
937 AV_WN16(
out->data[0] +
out->linesize[0] * y0 + 2 * x0, (
s->max - 1) * ((
s->nb_values +
state) & 1));
943 if (x0 ==
x1 && y0 ==
y1)
965 float average[4] = { 0 };
967 int min[4] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX };
974 s->ox,
s->oy,
s->width,
s->height + 20 *
s->statistics);
978 s->ox,
s->oy,
s->width - 1, 1);
980 for (
i = 1;
i < 5;
i++) {
982 s->ox,
s->oy +
i * (
s->height - 1) / 4,
s->width, 1);
985 for (
i = 0;
i < 10;
i++) {
987 s->ox +
i * (
s->width - 1) / 10,
s->oy, 1,
s->height);
991 s->ox +
s->width - 1,
s->oy, 1,
s->height);
996 for (
i = 0;
i <
s->nb_values;
i++) {
997 for (
c = 0;
c <
s->nb_comps;
c++) {
998 if ((1 <<
c) &
s->components) {
1001 average[
c] +=
s->values[
i].p[
s->rgba_map[
c]];
1005 for (
c = 0;
c <
s->nb_comps;
c++) {
1006 average[
c] /=
s->nb_values;
1009 if (
s->statistics &&
s->height > 10 &&
s->width > 280 * av_popcount(
s->components)) {
1010 for (
c = 0,
i = 0;
c <
s->nb_comps;
c++) {
1011 if ((1 <<
c) &
s->components) {
1012 const char rgba[4] = {
'R',
'G',
'B',
'A' };
1013 const char yuva[4] = {
'Y',
'U',
'V',
'A' };
1016 snprintf(text,
sizeof(text),
"%c avg:%.1f min:%d max:%d\n",
s->is_rgb ? rgba[
c] : yuva[
c], average[
c],
min[
c],
max[
c]);
1031 .needs_writable = 1,
1045 .
name =
"oscilloscope",
1048 .priv_class = &oscilloscope_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
#define AV_LOG_WARNING
Something somehow does not look correct.
static void reverse_color8(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *reverse)
static const AVFilterPad pixscope_inputs[]
static int filter_mono(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
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 const AVFilterPad pixscope_outputs[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int filter_color2(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
const struct AVPixFmtDescriptor * desc
int depth
Number of bits in the component.
const char * name
Filter name.
static uint32_t reverse(uint32_t num, int bits)
static void pick_color8(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value)
AVFormatInternal * internal
An opaque field for libavformat internal usage.
A link between two filters.
int pixelstep[MAX_PLANES]
void(* draw_trace)(struct OscilloscopeContext *s, AVFrame *frame)
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
void * priv
private data for use by the filter
void ff_blend_mask(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h, const uint8_t *mask, int mask_linesize, int mask_w, int mask_h, int l2depth, unsigned endianness, int x0, int y0)
Blend an alpha mask with an uniform color.
void(* reverse_color)(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *reverse)
A filter pad used for either input or output.
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
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int filter_color(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int(* filter)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static void oscilloscope_uninit(AVFilterContext *ctx)
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 format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
static int config_input(AVFilterLink *inlink)
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
static const AVFilterPad inputs[]
static const AVFilterPad oscilloscope_outputs[]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
static void pick_color16(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value)
static void reverse_color16(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *reverse)
static int query_formats(AVFilterContext *ctx)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Describe the class of an AVClass context structure.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Rational number (pair of numerator and denominator).
F H1 F F H1 F F F F H1<-F-------F-------F v v v H2 H3 H2 ^ ^ ^ F-------F-------F-> H1<-F-------F-------F|||||||||F H1 F|||||||||F H1 Funavailable fullpel samples(outside the picture for example) shall be equalto the closest available fullpel sampleSmaller pel interpolation:--------------------------if diag_mc is set then points which lie on a line between 2 vertically, horizontally or diagonally adjacent halfpel points shall be interpolatedlinearly with rounding to nearest and halfway values rounded up.points which lie on 2 diagonals at the same time should only use the onediagonal not containing the fullpel point F--> O q O<--h1-> O q O<--F v \/v \/v O O O O O O O|/|\|q q q q q|/|\|O O O O O O O ^/\ ^/\ ^ h2--> O q O<--h3-> O q O<--h2 v \/v \/v O O O O O O O|\|/|q q q q q|\|/|O O O O O O O ^/\ ^/\ ^ F--> O q O<--h1-> O q O<--Fthe remaining points shall be bilinearly interpolated from theup to 4 surrounding halfpel and fullpel points, again rounding should be tonearest and halfway values rounded upcompliant Snow decoders MUST support 1-1/8 pel luma and 1/2-1/16 pel chromainterpolation at leastOverlapped block motion compensation:-------------------------------------FIXMELL band prediction:===================Each sample in the LL0 subband is predicted by the median of the left, top andleft+top-topleft samples, samples outside the subband shall be considered tobe 0. To reverse this prediction in the decoder apply the following.for(y=0;y< height;y++){ for(x=0;x< width;x++){ sample[y][x]+=median(sample[y-1][x], sample[y][x-1], sample[y-1][x]+sample[y][x-1]-sample[y-1][x-1]);}}sample[-1][ *]=sample[ *][-1]=0;width, height here are the width and height of the LL0 subband not of the finalvideoDequantization:===============FIXMEWavelet Transform:==================Snow supports 2 wavelet transforms, the symmetric biorthogonal 5/3 integertransform and an integer approximation of the symmetric biorthogonal 9/7daubechies wavelet.2D IDWT(inverse discrete wavelet transform) --------------------------------------------The 2D IDWT applies a 2D filter recursively, each time combining the4 lowest frequency subbands into a single subband until only 1 subbandremains.The 2D filter is done by first applying a 1D filter in the vertical directionand then applying it in the horizontal one. --------------- --------------- --------------- ---------------|LL0|HL0|||||||||||||---+---|HL1||L0|H0|HL1||LL1|HL1|||||LH0|HH0|||||||||||||-------+-------|-> L1 H1 LH1 HH1 LH1 HH1 LH1 HH1 this can end with a L or a H
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
static const AVOption datascope_options[]
static const AVOption oscilloscope_options[]
void(* pick_color)(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value)
static void draw_trace8(OscilloscopeContext *s, AVFrame *frame)
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
AVFILTER_DEFINE_CLASS(datascope)
static void draw_trace16(OscilloscopeContext *s, AVFrame *frame)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
void ff_blend_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h, int x0, int y0, int w, int h)
Blend a rectangle with an uniform color.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
static av_const double hypot(double x, double y)
static const AVFilterPad outputs[]
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color, int x0, int y0, const uint8_t *text, int vertical)
static const AVFilterPad oscilloscope_inputs[]
void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color, uint8_t *dst[], int dst_linesize[], int dst_x, int dst_y, int w, int h)
Fill a rectangle with an uniform color.
AVFilterContext * src
source filter
static int pixscope_filter_frame(AVFilterLink *inlink, AVFrame *in)
void(* pick_color)(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value)
AVFilter ff_vf_oscilloscope
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
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)
int w
agreed upon image width
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Used for passing data between threads.
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 default value
const char * name
Pad name.
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
void(* pick_color)(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value)
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
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
int h
agreed upon image height
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
static void draw_scope(OscilloscopeContext *s, int x0, int y0, int x1, int y1, AVFrame *out, PixelValues *p, int state)
const uint8_t avpriv_cga_font[2048]
static const int16_t alpha[]
static int config_output(AVFilterLink *outlink)
static void draw_line(FFDrawContext *draw, int x0, int y0, int x1, int y1, AVFrame *out, FFDrawColor *color)
static const AVOption pixscope_options[]
static int pixscope_config_input(AVFilterLink *inlink)
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
#define flags(name, subs,...)
static av_cold int uninit(AVCodecContext *avctx)
static int oscilloscope_filter_frame(AVFilterLink *inlink, AVFrame *frame)
static int oscilloscope_config_input(AVFilterLink *inlink)