52 #define OFFSET(x) offsetof(DatascopeContext, x)
53 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
76 int x0,
int y0,
const uint8_t *text,
int vertical)
80 for (; *text; text++) {
102 color->
rgba[3] = 255;
106 for (i = 0; i < 4; i++) {
108 color->
comp[0].
u8[i] = value[i];
112 color->
comp[p].
u8[0] = value[p];
116 for (i = 0; i < 4; i++) {
118 color->
comp[0].
u16[i] = value[i];
122 color->
comp[p].
u16[0] = value[p];
132 reverse->
rgba[3] = 255;
135 reverse->
comp[p].
u8[0] = color->
comp[p].
u8[0] > 127 ? 0 : 255;
136 reverse->
comp[p].
u8[1] = color->
comp[p].
u8[1] > 127 ? 0 : 255;
137 reverse->
comp[p].
u8[2] = color->
comp[p].
u8[2] > 127 ? 0 : 255;
138 reverse->
comp[p].
u8[3] = color->
comp[p].
u8[3] > 127 ? 0 : 255;
141 const unsigned mid = (max + 1) / 2;
164 const int xoff = td->
xoff;
165 const int yoff = td->
yoff;
168 const int W = (outlink->
w - xoff) / (C * 10);
169 const int H = (outlink->
h - yoff) / (P * 12);
170 const char *
format[2] = {
"%02X\n",
"%04X\n"};
171 const int slice_start = (W * jobnr) / nb_jobs;
172 const int slice_end = (W * (jobnr+1)) / nb_jobs;
175 for (y = 0; y < H && (y + s->
y < inlink->
h); y++) {
176 for (x = slice_start; x < slice_end && (x + s->
x < inlink->
w); x++) {
179 int value[4] = { 0 };
184 xoff + x * C * 10, yoff + y * P * 12, C * 10, P * 12);
186 for (p = 0; p <
P; p++) {
189 snprintf(text,
sizeof(text), format[C>>2], value[p]);
190 draw_text(s, out, &reverse, xoff + x * C * 10 + 2, yoff + y * P * 12 + p * 10 + 2, text, 0);
206 const int xoff = td->
xoff;
207 const int yoff = td->
yoff;
210 const int W = (outlink->
w - xoff) / (C * 10);
211 const int H = (outlink->
h - yoff) / (P * 12);
212 const char *
format[2] = {
"%02X\n",
"%04X\n"};
213 const int slice_start = (W * jobnr) / nb_jobs;
214 const int slice_end = (W * (jobnr+1)) / nb_jobs;
217 for (y = 0; y < H && (y + s->
y < inlink->
h); y++) {
218 for (x = slice_start; x < slice_end && (x + s->
x < inlink->
w); x++) {
220 int value[4] = { 0 };
224 for (p = 0; p <
P; p++) {
227 snprintf(text,
sizeof(text), format[C>>2], value[p]);
228 draw_text(s, out, &color, xoff + x * C * 10 + 2, yoff + y * P * 12 + p * 10 + 2, text, 0);
244 const int xoff = td->
xoff;
245 const int yoff = td->
yoff;
248 const int W = (outlink->
w - xoff) / (C * 10);
249 const int H = (outlink->
h - yoff) / (P * 12);
250 const char *
format[2] = {
"%02X\n",
"%04X\n"};
251 const int slice_start = (W * jobnr) / nb_jobs;
252 const int slice_end = (W * (jobnr+1)) / nb_jobs;
255 for (y = 0; y < H && (y + s->
y < inlink->
h); y++) {
256 for (x = slice_start; x < slice_end && (x + s->
x < inlink->
w); x++) {
258 int value[4] = { 0 };
261 for (p = 0; p <
P; p++) {
264 snprintf(text,
sizeof(text), format[C>>2], value[p]);
265 draw_text(s, out, &s->
white, xoff + x * C * 10 + 2, yoff + y * P * 12 + p * 10 + 2, text, 0);
291 0, 0, outlink->
w, outlink->
h);
296 int Y = outlink->
h / (P * 12);
297 int X = outlink->
w / (C * 10);
298 char text[256] = { 0 };
301 snprintf(text,
sizeof(text),
"%d", s->
y + Y);
302 ymaxlen = strlen(text);
304 snprintf(text,
sizeof(text),
"%d", s->
x + X);
305 xmaxlen = strlen(text);
308 Y = (outlink->
h - xmaxlen) / (P * 12);
309 X = (outlink->
w - ymaxlen) / (C * 10);
311 for (y = 0; y <
Y; y++) {
312 snprintf(text,
sizeof(text),
"%d", s->
y + y);
315 0, xmaxlen + y * P * 12 + (P + 1) * P - 2, ymaxlen, 10);
317 draw_text(s, out, &s->
yellow, 2, xmaxlen + y * P * 12 + (P + 1) * P, text, 0);
320 for (x = 0; x < X; x++) {
321 snprintf(text,
sizeof(text),
"%d", s->
x + x);
324 ymaxlen + x * C * 10 + 2 * C - 2, 0, 10, xmaxlen);
326 draw_text(s, out, &s->
yellow, ymaxlen + x * C * 10 + 2 * C, 2, text, 1);
347 s->chars = (
s->draw.desc->comp[0].depth + 7) / 8 * 2;
348 s->nb_comps =
s->draw.desc->nb_components;
393 .priv_class = &datascope_class,
AVFilterFormats * ff_draw_supported_pixel_formats(unsigned flags)
Return the list of pixel formats supported by the draw functions.
This structure describes decoded (raw) audio or video data.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Main libavfilter public API header.
int h
agreed upon image height
static int filter_color2(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static int filter_mono(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
struct AVFilterGraph * graph
filtergraph this filter belongs to
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
static void reverse_color(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *reverse)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static int filter_color(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int(* filter)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int nb_threads
Maximum number of threads used by filters in this graph.
static const AVFilterPad inputs[]
A filter pad used for either input or output.
A link between two filters.
static const AVOption datascope_options[]
int width
width and height of the video frame
const uint8_t avpriv_cga_font[2048]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#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
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
static void pick_color(FFDrawContext *draw, FFDrawColor *color, AVFrame *in, int x, int y, int *value)
void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4])
Prepare a color.
simple assert() macros that are a bit more flexible than ISO C assert().
union FFDrawColor::@154 comp[MAX_PLANES]
int w
agreed upon image width
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static void draw_text(DatascopeContext *s, AVFrame *frame, FFDrawColor *color, int x0, int y0, const uint8_t *text, int vertical)
GLsizei GLboolean const GLfloat * value
static int config_input(AVFilterLink *inlink)
static int query_formats(AVFilterContext *ctx)
AVFilterContext * src
source filter
int format
agreed upon media format
AVFILTER_DEFINE_CLASS(datascope)
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.
static const AVFilterPad outputs[]
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
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-> in
static const char * format
Describe the class of an AVClass context structure.
rational number numerator/denominator
const char * name
Filter name.
int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
Init a draw context.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
offset must point to two consecutive integers
AVFilterLink ** outputs
array of pointers to output links
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int config_output(AVFilterLink *outlink)
avfilter_execute_func * execute
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
AVFilterContext * dst
dest filter
int pixelstep[MAX_PLANES]
const struct AVPixFmtDescriptor * desc
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.
int depth
Number of bits in the component.
CGA/EGA/VGA ROM font data.