66 const uint8_t *
c[],
int peak,
int radius,
70 #define OFFSET(x) offsetof(ConvolutionContext, x)
71 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
102 static const int same5x5[25] = {0, 0, 0, 0, 0,
108 static const int same7x7[49] = {0, 0, 0, 0, 0, 0, 0,
114 0, 0, 0, 0, 0, 0, 0};
147 float scale,
float delta,
const int *
const matrix,
148 const uint8_t *
c[],
int peak,
int radius,
151 uint16_t *dst = (uint16_t *)dstp;
154 for (x = 0; x <
width; x++) {
160 dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
165 float scale,
float delta,
const int *
const matrix,
166 const uint8_t *
c[],
int peak,
int radius,
169 uint16_t *dst = (uint16_t *)dstp;
172 for (x = 0; x <
width; x++) {
176 dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
181 float scale,
float delta,
const int *
const matrix,
182 const uint8_t *
c[],
int peak,
int radius,
185 uint16_t *dst = (uint16_t *)dstp;
188 for (x = 0; x <
width; x++) {
194 dst[x] = av_clip(sqrt(suma*suma + sumb*sumb) * scale + delta, 0, peak);
199 float scale,
float delta,
const int *
const matrix,
200 const uint8_t *
c[],
int peak,
int radius,
204 const uint8_t *c3 = c[3], *c5 = c[5];
205 const uint8_t *c6 = c[6], *c7 = c[7], *c8 = c[8];
208 for (x = 0; x <
width; x++) {
209 int suma = c0[x] * -1 + c1[x] * -1 + c2[x] * -1 +
210 c6[x] * 1 + c7[x] * 1 + c8[x] * 1;
211 int sumb = c0[x] * -1 + c2[x] * 1 + c3[x] * -1 +
212 c5[x] * 1 + c6[x] * -1 + c8[x] * 1;
214 dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
219 float scale,
float delta,
const int *
const matrix,
220 const uint8_t *
c[],
int peak,
int radius,
225 for (x = 0; x <
width; x++) {
226 int suma = c[0][x] * 1 + c[1][x] * -1;
227 int sumb = c[4][x] * 1 + c[3][x] * -1;
229 dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
234 float scale,
float delta,
const int *
const matrix,
235 const uint8_t *
c[],
int peak,
int radius,
239 const uint8_t *c3 = c[3], *c5 = c[5];
240 const uint8_t *c6 = c[6], *c7 = c[7], *c8 = c[8];
243 for (x = 0; x <
width; x++) {
244 int suma = c0[x] * -1 + c1[x] * -2 + c2[x] * -1 +
245 c6[x] * 1 + c7[x] * 2 + c8[x] * 1;
246 int sumb = c0[x] * -1 + c2[x] * 1 + c3[x] * -2 +
247 c5[x] * 2 + c6[x] * -1 + c8[x] * 1;
249 dst[x] = av_clip_uint8(sqrt(suma*suma + sumb*sumb) * scale + delta);
254 float rdiv,
float bias,
const int *
const matrix,
255 const uint8_t *
c[],
int peak,
int radius,
258 uint16_t *dst = (uint16_t *)dstp;
261 for (x = 0; x <
width; x++) {
262 int sum =
AV_RN16A(&c[0][2 * x]) * matrix[0] +
263 AV_RN16A(&c[1][2 * x]) * matrix[1] +
264 AV_RN16A(&c[2][2 * x]) * matrix[2] +
265 AV_RN16A(&c[3][2 * x]) * matrix[3] +
266 AV_RN16A(&c[4][2 * x]) * matrix[4] +
267 AV_RN16A(&c[5][2 * x]) * matrix[5] +
268 AV_RN16A(&c[6][2 * x]) * matrix[6] +
269 AV_RN16A(&c[7][2 * x]) * matrix[7] +
271 sum = (
int)(sum * rdiv + bias + 0.5
f);
272 dst[x] = av_clip(sum, 0, peak);
277 float rdiv,
float bias,
const int *
const matrix,
278 const uint8_t *
c[],
int peak,
int radius,
281 uint16_t *dst = (uint16_t *)dstp;
284 for (x = 0; x <
width; x++) {
287 for (i = 0; i < 25; i++)
288 sum +=
AV_RN16A(&c[i][2 * x]) * matrix[i];
290 sum = (
int)(sum * rdiv + bias + 0.5
f);
291 dst[x] = av_clip(sum, 0, peak);
296 float rdiv,
float bias,
const int *
const matrix,
297 const uint8_t *
c[],
int peak,
int radius,
300 uint16_t *dst = (uint16_t *)dstp;
303 for (x = 0; x <
width; x++) {
306 for (i = 0; i < 49; i++)
307 sum +=
AV_RN16A(&c[i][2 * x]) * matrix[i];
309 sum = (
int)(sum * rdiv + bias + 0.5
f);
310 dst[x] = av_clip(sum, 0, peak);
315 float rdiv,
float bias,
const int *
const matrix,
316 const uint8_t *
c[],
int peak,
int radius,
319 uint16_t *dst = (uint16_t *)dstp;
322 for (x = 0; x <
width; x++) {
325 for (i = 0; i < 2 * radius + 1; i++)
326 sum +=
AV_RN16A(&c[i][2 * x]) * matrix[i];
328 sum = (
int)(sum * rdiv + bias + 0.5
f);
329 dst[x] = av_clip(sum, 0, peak);
334 float rdiv,
float bias,
const int *
const matrix,
335 const uint8_t *
c[],
int peak,
int radius,
338 uint16_t *dst = (uint16_t *)dstp;
341 for (y = 0; y <
height; y++) {
344 for (i = 0; i < 2 * radius + 1; i++)
345 sum +=
AV_RN16A(&c[i][0 + y * stride]) * matrix[i];
347 sum = (
int)(sum * rdiv + bias + 0.5
f);
348 dst[0] = av_clip(sum, 0, peak);
354 float rdiv,
float bias,
const int *
const matrix,
355 const uint8_t *
c[],
int peak,
int radius,
360 for (x = 0; x <
width; x++) {
363 for (i = 0; i < 49; i++)
364 sum += c[i][x] * matrix[i];
366 sum = (
int)(sum * rdiv + bias + 0.5
f);
367 dst[x] = av_clip_uint8(sum);
372 float rdiv,
float bias,
const int *
const matrix,
373 const uint8_t *
c[],
int peak,
int radius,
378 for (x = 0; x <
width; x++) {
381 for (i = 0; i < 25; i++)
382 sum += c[i][x] * matrix[i];
384 sum = (
int)(sum * rdiv + bias + 0.5
f);
385 dst[x] = av_clip_uint8(sum);
390 float rdiv,
float bias,
const int *
const matrix,
391 const uint8_t *
c[],
int peak,
int radius,
395 const uint8_t *c3 = c[3], *c4 = c[4], *c5 = c[5];
396 const uint8_t *c6 = c[6], *c7 = c[7], *c8 = c[8];
399 for (x = 0; x <
width; x++) {
400 int sum = c0[x] * matrix[0] + c1[x] * matrix[1] + c2[x] * matrix[2] +
401 c3[x] * matrix[3] + c4[x] * matrix[4] + c5[x] * matrix[5] +
402 c6[x] * matrix[6] + c7[x] * matrix[7] + c8[x] * matrix[8];
403 sum = (
int)(sum * rdiv + bias + 0.5
f);
404 dst[x] = av_clip_uint8(sum);
409 float rdiv,
float bias,
const int *
const matrix,
410 const uint8_t *
c[],
int peak,
int radius,
415 for (x = 0; x <
width; x++) {
418 for (i = 0; i < 2 * radius + 1; i++)
419 sum += c[i][x] * matrix[i];
421 sum = (
int)(sum * rdiv + bias + 0.5
f);
422 dst[x] = av_clip_uint8(sum);
427 float rdiv,
float bias,
const int *
const matrix,
428 const uint8_t *
c[],
int peak,
int radius,
433 for (y = 0; y <
height; y++) {
436 for (i = 0; i < 2 * radius + 1; i++)
437 sum += c[i][0 + y * stride] * matrix[i];
439 sum = (
int)(sum * rdiv + bias + 0.5
f);
440 dst[0] = av_clip_uint8(sum);
446 int x,
int w,
int y,
int h,
int bpc)
450 for (i = 0; i < 9; i++) {
451 int xoff =
FFABS(x + ((i % 3) - 1));
452 int yoff =
FFABS(y + (i / 3) - 1);
454 xoff = xoff >= w ? 2 * w - 1 - xoff : xoff;
455 yoff = yoff >= h ? 2 * h - 1 - yoff : yoff;
457 c[i] = src + xoff * bpc + yoff *
stride;
462 int x,
int w,
int y,
int h,
int bpc)
466 for (i = 0; i < 25; i++) {
467 int xoff =
FFABS(x + ((i % 5) - 2));
468 int yoff =
FFABS(y + (i / 5) - 2);
470 xoff = xoff >= w ? 2 * w - 1 - xoff : xoff;
471 yoff = yoff >= h ? 2 * h - 1 - yoff : yoff;
473 c[i] = src + xoff * bpc + yoff *
stride;
478 int x,
int w,
int y,
int h,
int bpc)
482 for (i = 0; i < 49; i++) {
483 int xoff =
FFABS(x + ((i % 7) - 3));
484 int yoff =
FFABS(y + (i / 7) - 3);
486 xoff = xoff >= w ? 2 * w - 1 - xoff : xoff;
487 yoff = yoff >= h ? 2 * h - 1 - yoff : yoff;
489 c[i] = src + xoff * bpc + yoff *
stride;
494 int x,
int w,
int y,
int h,
int bpc)
498 for (i = 0; i < radius * 2 + 1; i++) {
499 int xoff =
FFABS(x + i - radius);
501 xoff = xoff >= w ? 2 * w - 1 - xoff : xoff;
503 c[i] = src + xoff * bpc + y *
stride;
508 int x,
int w,
int y,
int h,
int bpc)
512 for (i = 0; i < radius * 2 + 1; i++) {
513 int xoff =
FFABS(x + i - radius);
515 xoff = xoff >= h ? 2 * h - 1 - xoff : xoff;
517 c[i] = src + y * bpc + xoff *
stride;
529 for (plane = 0; plane < s->
nb_planes; plane++) {
531 const int bpc = s->
bpc;
539 const int slice_start = (sizeh * jobnr) / nb_jobs;
540 const int slice_end = (sizeh * (jobnr+1)) / nb_jobs;
544 const int dst_pos = slice_start * (mode ==
MATRIX_COLUMN ? bpc : dstride);
550 if (s->
copy[plane]) {
553 (slice_end - slice_start) * bpc, height);
556 width * bpc, slice_end - slice_start);
560 for (y = slice_start; y <
slice_end; y++) {
561 const int xoff = mode ==
MATRIX_COLUMN ? (y - slice_start) * bpc : radius * bpc;
562 const int yoff = mode ==
MATRIX_COLUMN ? radius * stride : 0;
564 for (x = 0; x < radius; x++) {
565 const int xoff = mode ==
MATRIX_COLUMN ? (y - slice_start) * bpc : x * bpc;
570 bias, matrix,
c, s->
max, radius,
574 s->
filter[
plane](dst + yoff + xoff, sizew - 2 * radius,
575 rdiv, bias, matrix,
c, s->
max, radius,
577 for (x = sizew - radius; x < sizew; x++) {
578 const int xoff = mode ==
MATRIX_COLUMN ? (y - slice_start) * bpc : x * bpc;
583 bias, matrix,
c, s->
max, radius,
613 if (!strcmp(ctx->
filter->
name,
"convolution")) {
620 else if (s->
size[p] == 3)
622 else if (s->
size[p] == 5)
624 else if (s->
size[p] == 7)
628 }
else if (!strcmp(ctx->
filter->
name,
"prewitt")) {
632 }
else if (!strcmp(ctx->
filter->
name,
"roberts")) {
636 }
else if (!strcmp(ctx->
filter->
name,
"sobel")) {
673 if (!strcmp(ctx->
filter->
name,
"convolution")) {
674 for (i = 0; i < 4; i++) {
675 int *matrix = (
int *)s->
matrix[i];
676 char *p, *
arg, *saveptr =
NULL;
730 s->
rdiv[i] = 1. / sum;
732 if (s->
copy[i] && (s->
rdiv[i] != 1. || s->
bias[i] != 0.))
735 }
else if (!strcmp(ctx->
filter->
name,
"prewitt")) {
736 for (i = 0; i < 4; i++) {
746 }
else if (!strcmp(ctx->
filter->
name,
"roberts")) {
747 for (i = 0; i < 4; i++) {
757 }
else if (!strcmp(ctx->
filter->
name,
"sobel")) {
758 for (i = 0; i < 4; i++) {
791 #if CONFIG_CONVOLUTION_FILTER
794 .
name =
"convolution",
797 .priv_class = &convolution_class,
800 .
inputs = convolution_inputs,
801 .
outputs = convolution_outputs,
807 #if CONFIG_PREWITT_FILTER
809 static const AVOption prewitt_options[] = {
822 .priv_class = &prewitt_class,
825 .
inputs = convolution_inputs,
826 .
outputs = convolution_outputs,
832 #if CONFIG_SOBEL_FILTER
834 static const AVOption sobel_options[] = {
847 .priv_class = &sobel_class,
850 .
inputs = convolution_inputs,
851 .
outputs = convolution_outputs,
857 #if CONFIG_ROBERTS_FILTER
859 static const AVOption roberts_options[] = {
872 .priv_class = &roberts_class,
875 .
inputs = convolution_inputs,
876 .
outputs = convolution_outputs,
#define AV_PIX_FMT_YUVA422P16
#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.
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUV444P14
static void filter16_sobel(uint8_t *dstp, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
#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 void filter16_column(uint8_t *dstp, int height, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
static void setup_7x7(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
#define AV_PIX_FMT_YUV420P12
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static int filter_slice(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.
#define AV_PIX_FMT_GRAY10
static void filter16_row(uint8_t *dstp, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
const char * name
Pad name.
#define AV_PIX_FMT_GRAY12
static void setup_5x5(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
static void filter_7x7(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
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 void filter_5x5(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
#define AV_PIX_FMT_YUVA420P9
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...
void(* setup[4])(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int width, int y, int height, int bpc)
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUVA420P16
AVFilter ff_vf_convolution
A filter pad used for either input or output.
A link between two filters.
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const int same7x7[49]
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
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
static void filter_row(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
#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
static const struct @304 planes[]
static void filter16_prewitt(uint8_t *dstp, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
#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 void filter16_3x3(uint8_t *dstp, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static const AVOption convolution_options[]
static int query_formats(AVFilterContext *ctx)
static av_cold int init(AVFilterContext *ctx)
static void filter_prewitt(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#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
static void filter_roberts(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
#define AV_PIX_FMT_YUV420P14
Used for passing data between threads.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
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...
static void filter_column(uint8_t *dst, int height, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
#define AV_PIX_FMT_GRAY14
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
#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.
static void setup_3x3(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
AVFILTER_DEFINE_CLASS(convolution)
static const int same3x3[9]
static void setup_row(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
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
#define flags(name, subs,...)
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()...
static void filter_sobel(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
static void setup_column(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
GLint GLenum GLboolean GLsizei stride
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static void filter16_5x5(uint8_t *dstp, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
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...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
avfilter_execute_func * execute
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
static void filter16_roberts(uint8_t *dstp, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
AVFilterContext * dst
dest filter
static void filter16_7x7(uint8_t *dstp, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
static void filter_3x3(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
static int config_input(AVFilterLink *inlink)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
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.
void(* filter[4])(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride)
int depth
Number of bits in the component.
AVPixelFormat
Pixel format.
mode
Use these values in ebur128_init (or'ed).
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)