58 #define OFFSET(x) offsetof(ConvolutionContext, x) 59 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 83 static const int same5x5[25] = {0, 0, 0, 0, 0,
89 static const int same7x7[49] = {0, 0, 0, 0, 0, 0, 0,
127 memcpy(line, srcp, width);
129 for (i = mergin; i > 0; i--) {
131 line[width - 1 + i] = line[width - 1 - i];
139 memcpy(line, srcp, width * 2);
141 for (i = mergin; i > 0; i--) {
143 line[width - 1 + i] = line[width - 1 - i];
159 const int peak = (1 << s->
depth) - 1;
164 const int slice_start = (height * jobnr) / nb_jobs;
165 const int slice_end = (height * (jobnr+1)) / nb_jobs;
166 const uint16_t *
src = (
const uint16_t *)in->
data[plane] + slice_start * stride;
170 uint16_t *p0 = (uint16_t *)s->
bptrs[jobnr] + 16;
171 uint16_t *p1 = p0 + bstride;
172 uint16_t *p2 = p1 + bstride;
173 uint16_t *orig = p0, *
end = p2;
179 for (y = slice_start; y <
slice_end; y++) {
180 src += stride * (y < height - 1 ? 1 : -1);
183 for (x = 0; x <
width; x++) {
184 int suma = p0[x - 1] * -1 +
190 int sumb = p0[x - 1] * -1 +
197 dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
202 p2 = (p2 ==
end) ? orig: p2 + bstride;
216 const int peak = (1 << s->
depth) - 1;
221 const int slice_start = (height * jobnr) / nb_jobs;
222 const int slice_end = (height * (jobnr+1)) / nb_jobs;
223 const uint16_t *
src = (
const uint16_t *)in->
data[plane] + slice_start * stride;
227 uint16_t *p0 = (uint16_t *)s->
bptrs[jobnr] + 16;
228 uint16_t *p1 = p0 + bstride;
229 uint16_t *p2 = p1 + bstride;
230 uint16_t *orig = p0, *
end = p2;
236 for (y = slice_start; y <
slice_end; y++) {
237 src += stride * (y < height - 1 ? 1 : -1);
240 for (x = 0; x <
width; x++) {
241 int suma = p0[x - 1] * 1 +
243 int sumb = p0[x ] * 1 +
246 dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
251 p2 = (p2 ==
end) ? orig: p2 + bstride;
265 const int peak = (1 << s->
depth) - 1;
270 const int slice_start = (height * jobnr) / nb_jobs;
271 const int slice_end = (height * (jobnr+1)) / nb_jobs;
272 const uint16_t *
src = (
const uint16_t *)in->
data[plane] + slice_start * stride;
276 uint16_t *p0 = (uint16_t *)s->
bptrs[jobnr] + 16;
277 uint16_t *p1 = p0 + bstride;
278 uint16_t *p2 = p1 + bstride;
279 uint16_t *orig = p0, *
end = p2;
285 for (y = slice_start; y <
slice_end; y++) {
286 src += stride * (y < height - 1 ? 1 : -1);
289 for (x = 0; x <
width; x++) {
290 int suma = p0[x - 1] * -1 +
296 int sumb = p0[x - 1] * -1 +
303 dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
308 p2 = (p2 ==
end) ? orig: p2 + bstride;
326 const int slice_start = (height * jobnr) / nb_jobs;
327 const int slice_end = (height * (jobnr+1)) / nb_jobs;
338 line_copy8(p0, src + stride * (slice_start == 0 ? 1 : -1), width, 1);
341 for (y = slice_start; y <
slice_end; y++) {
342 src += stride * (y < height - 1 ? 1 : -1);
345 for (x = 0; x <
width; x++) {
346 int suma = p0[x - 1] * -1 +
352 int sumb = p0[x - 1] * -1 +
359 dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
364 p2 = (p2 ==
end) ? orig: p2 + bstride;
382 const int slice_start = (height * jobnr) / nb_jobs;
383 const int slice_end = (height * (jobnr+1)) / nb_jobs;
394 line_copy8(p0, src + stride * (slice_start == 0 ? 1 : -1), width, 1);
397 for (y = slice_start; y <
slice_end; y++) {
398 src += stride * (y < height - 1 ? 1 : -1);
401 for (x = 0; x <
width; x++) {
402 int suma = p0[x - 1] * 1 +
404 int sumb = p0[x ] * 1 +
407 dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
412 p2 = (p2 ==
end) ? orig: p2 + bstride;
430 const int slice_start = (height * jobnr) / nb_jobs;
431 const int slice_end = (height * (jobnr+1)) / nb_jobs;
442 line_copy8(p0, src + stride * (slice_start == 0 ? 1 : -1), width, 1);
445 for (y = slice_start; y <
slice_end; y++) {
446 src += stride * (y < height - 1 ? 1 : -1);
449 for (x = 0; x <
width; x++) {
450 int suma = p0[x - 1] * -1 +
456 int sumb = p0[x - 1] * -1 +
463 dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
468 p2 = (p2 ==
end) ? orig: p2 + bstride;
482 const int peak = (1 << s->
depth) - 1;
487 const int slice_start = (height * jobnr) / nb_jobs;
488 const int slice_end = (height * (jobnr+1)) / nb_jobs;
489 const uint16_t *
src = (
const uint16_t *)in->
data[plane] + slice_start * stride;
491 uint16_t *p0 = (uint16_t *)s->
bptrs[jobnr] + 16;
492 uint16_t *p1 = p0 + bstride;
493 uint16_t *p2 = p1 + bstride;
494 uint16_t *orig = p0, *
end = p2;
503 for (y = slice_start; y <
slice_end; y++) {
504 src += stride * (y < height - 1 ? 1 : -1);
507 for (x = 0; x <
width; x++) {
508 int sum = p0[x - 1] *
matrix[0] +
518 dst[x] = av_clip(sum, 0, peak);
523 p2 = (p2 ==
end) ? orig: p2 + bstride;
537 const int peak = (1 << s->
depth) - 1;
542 const int slice_start = (height * jobnr) / nb_jobs;
543 const int slice_end = (height * (jobnr+1)) / nb_jobs;
544 const uint16_t *
src = (
const uint16_t *)in->
data[plane] + slice_start * stride;
546 uint16_t *p0 = (uint16_t *)s->
bptrs[jobnr] + 16;
547 uint16_t *p1 = p0 + bstride;
548 uint16_t *p2 = p1 + bstride;
549 uint16_t *p3 = p2 + bstride;
550 uint16_t *p4 = p3 + bstride;
551 uint16_t *orig = p0, *
end = p4;
558 line_copy16(p1, src + stride * (slice_start == 0 ? 1 : -1), width, 2);
563 for (y = slice_start; y <
slice_end; y++) {
564 uint16_t *
array[] = {
565 p0 - 2, p0 - 1, p0, p0 + 1, p0 + 2,
566 p1 - 2, p1 - 1, p1, p1 + 1, p1 + 2,
567 p2 - 2, p2 - 1, p2, p2 + 1, p2 + 2,
568 p3 - 2, p3 - 1, p3, p3 + 1, p3 + 2,
569 p4 - 2, p4 - 1, p4, p4 + 1, p4 + 2
572 src += stride * (y < height - 2 ? 1 : -1);
575 for (x = 0; x <
width; x++) {
578 for (i = 0; i < 25; i++) {
579 sum += *(array[i] + x) *
matrix[i];
582 dst[x] = av_clip(sum, 0, peak);
589 p4 = (p4 ==
end) ? orig: p4 + bstride;
603 const int peak = (1 << s->
depth) - 1;
608 const int slice_start = (height * jobnr) / nb_jobs;
609 const int slice_end = (height * (jobnr+1)) / nb_jobs;
610 const uint16_t *
src = (
const uint16_t *)in->
data[plane] + slice_start * stride;
612 uint16_t *p0 = (uint16_t *)s->
bptrs[jobnr] + 32;
613 uint16_t *p1 = p0 + bstride;
614 uint16_t *p2 = p1 + bstride;
615 uint16_t *p3 = p2 + bstride;
616 uint16_t *p4 = p3 + bstride;
617 uint16_t *p5 = p4 + bstride;
618 uint16_t *p6 = p5 + bstride;
619 uint16_t *orig = p0, *
end = p6;
626 line_copy16(p1, src + 2 * stride * (slice_start < 2 ? 1 : -1), width, 3);
627 line_copy16(p2, src + stride * (slice_start == 0 ? 1 : -1), width, 3);
634 for (y = slice_start; y <
slice_end; y++) {
635 uint16_t *
array[] = {
636 p0 - 3, p0 - 2, p0 - 1, p0, p0 + 1, p0 + 2, p0 + 3,
637 p1 - 3, p1 - 2, p1 - 1, p1, p1 + 1, p1 + 2, p1 + 3,
638 p2 - 3, p2 - 2, p2 - 1, p2, p2 + 1, p2 + 2, p2 + 3,
639 p3 - 3, p3 - 2, p3 - 1, p3, p3 + 1, p3 + 2, p3 + 3,
640 p4 - 3, p4 - 2, p4 - 1, p4, p4 + 1, p4 + 2, p4 + 3,
641 p5 - 3, p5 - 2, p5 - 1, p5, p5 + 1, p5 + 2, p5 + 3,
642 p6 - 3, p6 - 2, p6 - 1, p6, p6 + 1, p6 + 2, p6 + 3,
645 src += stride * (y < height - 3 ? 1 : -1);
648 for (x = 0; x <
width; x++) {
651 for (i = 0; i < 25; i++) {
652 sum += *(array[i] + x) *
matrix[i];
655 dst[x] = av_clip(sum, 0, peak);
664 p6 = (p6 ==
end) ? orig: p6 + bstride;
682 const int slice_start = (height * jobnr) / nb_jobs;
683 const int slice_end = (height * (jobnr+1)) / nb_jobs;
695 line_copy8(p0, src + stride * (slice_start == 0 ? 1 : -1), width, 1);
698 for (y = slice_start; y <
slice_end; y++) {
699 src += stride * (y < height - 1 ? 1 : -1);
702 for (x = 0; x <
width; x++) {
703 int sum = p0[x - 1] * matrix[0] +
705 p0[x + 1] * matrix[2] +
706 p1[x - 1] * matrix[3] +
708 p1[x + 1] * matrix[5] +
709 p2[x - 1] * matrix[6] +
711 p2[x + 1] * matrix[8];
712 sum = (
int)(sum * rdiv + bias + 0.5f);
713 dst[x] = av_clip_uint8(sum);
718 p2 = (p2 ==
end) ? orig: p2 + bstride;
736 const int slice_start = (height * jobnr) / nb_jobs;
737 const int slice_end = (height * (jobnr+1)) / nb_jobs;
751 line_copy8(p0, src + 2 * stride * (slice_start < 2 ? 1 : -1), width, 2);
752 line_copy8(p1, src + stride * (slice_start == 0 ? 1 : -1), width, 2);
758 for (y = slice_start; y <
slice_end; y++) {
760 p0 - 2, p0 - 1, p0, p0 + 1, p0 + 2,
761 p1 - 2, p1 - 1, p1, p1 + 1, p1 + 2,
762 p2 - 2, p2 - 1, p2, p2 + 1, p2 + 2,
763 p3 - 2, p3 - 1, p3, p3 + 1, p3 + 2,
764 p4 - 2, p4 - 1, p4, p4 + 1, p4 + 2
767 src += stride * (y < height - 2 ? 1 : -1);
770 for (x = 0; x <
width; x++) {
773 for (i = 0; i < 25; i++) {
774 sum += *(array[i] + x) * matrix[i];
776 sum = (
int)(sum * rdiv + bias + 0.5f);
777 dst[x] = av_clip_uint8(sum);
784 p4 = (p4 ==
end) ? orig: p4 + bstride;
802 const int slice_start = (height * jobnr) / nb_jobs;
803 const int slice_end = (height * (jobnr+1)) / nb_jobs;
819 line_copy8(p0, src + 3 * stride * (slice_start < 3 ? 1 : -1), width, 3);
820 line_copy8(p1, src + 2 * stride * (slice_start < 2 ? 1 : -1), width, 3);
821 line_copy8(p2, src + stride * (slice_start == 0 ? 1 : -1), width, 3);
828 for (y = slice_start; y <
slice_end; y++) {
830 p0 - 3, p0 - 2, p0 - 1, p0, p0 + 1, p0 + 2, p0 + 3,
831 p1 - 3, p1 - 2, p1 - 1, p1, p1 + 1, p1 + 2, p1 + 3,
832 p2 - 3, p2 - 2, p2 - 1, p2, p2 + 1, p2 + 2, p2 + 3,
833 p3 - 3, p3 - 2, p3 - 1, p3, p3 + 1, p3 + 2, p3 + 3,
834 p4 - 3, p4 - 2, p4 - 1, p4, p4 + 1, p4 + 2, p4 + 3,
835 p5 - 3, p5 - 2, p5 - 1, p5, p5 + 1, p5 + 2, p5 + 3,
836 p6 - 3, p6 - 2, p6 - 1, p6, p6 + 1, p6 + 2, p6 + 3,
839 src += stride * (y < height - 3 ? 1 : -1);
842 for (x = 0; x <
width; x++) {
845 for (i = 0; i < 49; i++) {
846 sum += *(array[i] + x) * matrix[i];
848 sum = (
int)(sum * rdiv + bias + 0.5f);
849 dst[x] = av_clip_uint8(sum);
858 p6 = (p6 ==
end) ? orig: p6 + bstride;
895 if (!strcmp(ctx->
filter->
name,
"convolution")) {
900 else if (s->
size[p] == 5)
902 else if (s->
size[p] == 7)
906 }
else if (!strcmp(ctx->
filter->
name,
"prewitt")) {
910 }
else if (!strcmp(ctx->
filter->
name,
"roberts")) {
914 }
else if (!strcmp(ctx->
filter->
name,
"sobel")) {
938 for (plane = 0; plane < s->
nb_planes; plane++) {
941 if (s->
copy[plane]) {
964 if (!strcmp(ctx->
filter->
name,
"convolution")) {
965 for (i = 0; i < 4; i++) {
967 char *p, *
arg, *saveptr =
NULL;
1001 if (s->
copy[i] && (s->
rdiv[i] != 1. || s->
bias[i] != 0.))
1004 }
else if (!strcmp(ctx->
filter->
name,
"prewitt")) {
1005 for (i = 0; i < 4; i++) {
1006 if ((1 << i) & s->
planes)
1011 }
else if (!strcmp(ctx->
filter->
name,
"roberts")) {
1012 for (i = 0; i < 4; i++) {
1013 if ((1 << i) & s->
planes)
1018 }
else if (!strcmp(ctx->
filter->
name,
"sobel")) {
1019 for (i = 0; i < 4; i++) {
1020 if ((1 << i) & s->
planes)
1056 #if CONFIG_CONVOLUTION_FILTER 1059 .
name =
"convolution",
1062 .priv_class = &convolution_class,
1066 .
inputs = convolution_inputs,
1067 .
outputs = convolution_outputs,
1073 #if CONFIG_PREWITT_FILTER 1075 static const AVOption prewitt_options[] = {
1088 .priv_class = &prewitt_class,
1092 .
inputs = convolution_inputs,
1093 .
outputs = convolution_outputs,
1099 #if CONFIG_SOBEL_FILTER 1101 static const AVOption sobel_options[] = {
1114 .priv_class = &sobel_class,
1118 .
inputs = convolution_inputs,
1119 .
outputs = convolution_outputs,
1125 #if CONFIG_ROBERTS_FILTER 1127 static const AVOption roberts_options[] = {
1140 .priv_class = &roberts_class,
1144 .
inputs = convolution_inputs,
1145 .
outputs = convolution_outputs,
static int filter16_prewitt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_YUVA422P16
static int filter16_3x3(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_YUVA422P9
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
static int filter16_7x7(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA422P10
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Main libavfilter public API header.
static void sobel(int w, int h, uint16_t *dst, int dst_linesize, int8_t *dir, int dir_linesize, const uint8_t *src, int src_linesize)
int h
agreed upon image height
#define AV_PIX_FMT_GBRP10
static int filter16_5x5(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_YUV420P12
static int filter_sobel(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.
int(* filter[4])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
#define AV_PIX_FMT_GRAY10
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
BYTE int const BYTE * srcp
const char * name
Pad name.
#define AV_PIX_FMT_GRAY12
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static av_cold int end(AVCodecContext *avctx)
static int filter_roberts(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_YUVA420P9
static av_cold void uninit(AVFilterContext *ctx)
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUVA420P16
static void line_copy16(uint16_t *line, const uint16_t *srcp, int width, int mergin)
AVFilter ff_vf_convolution
A filter pad used for either input or output.
A link between two filters.
static void line_copy8(uint8_t *line, const uint8_t *srcp, int width, int mergin)
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
static const int same7x7[49]
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static int filter16_roberts(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
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. ...
static const AVFilterPad convolution_inputs[]
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...
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_GBRAP16
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_GBRP16
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
#define AV_PIX_FMT_GRAY16
static const AVFilterPad convolution_outputs[]
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
static const AVOption convolution_options[]
static int query_formats(AVFilterContext *ctx)
static av_cold int init(AVFilterContext *ctx)
#define AV_PIX_FMT_YUVA444P10
static const AVFilterPad inputs[]
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_GBRP14
static const AVFilterPad outputs[]
int format
agreed upon media format
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P14
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static int filter16_sobel(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
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)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Describe the class of an AVClass context structure.
AVFILTER_DEFINE_CLASS(convolution)
static const int same3x3[9]
const char * name
Filter name.
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV420P9
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GBRP12
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok()...
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar GBRA 4:4:4:4 32bpp
static const int same5x5[25]
#define AV_PIX_FMT_YUVA444P9
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
static int filter_5x5(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
avfilter_execute_func * execute
static int filter_prewitt(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
AVFilterContext * dst
dest filter
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
static int config_input(AVFilterLink *inlink)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
static int array[MAX_W *MAX_W]
#define av_malloc_array(a, b)
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
static int filter_3x3(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int depth
Number of bits in the component.
AVPixelFormat
Pixel format.
static int filter_7x7(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
const AVFilter * filter
the AVFilter of which this is an instance
#define AV_PIX_FMT_YUV422P16
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_CEIL_RSHIFT(a, b)