History

avfilter/vf_convolution: add x86 SIMD for filter_3x3()

Tested using a simple command (apply edge enhance): ./ffmpeg_g -i ~/Downloads/bbb_sunflower_1080p_30fps_normal.mp4 \ -vf convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128" \ -an -vframes 1000 -f null /dev/null The fps increase from 151 to 270 on my local machine.

Ruiling Song committed 7 years ago

Commit 98e419c1 parent 6c67c8c5 files · +271 −38Browse files

Showing the changes to libavfilter/convolution.h (1 of 5 files). Show all

Unified · Split

libavfilter/convolution.h+64−0
@@ -0,0 +1,64 @@
1/*
2 * Copyright (c) 2012-2013 Oka Motofumi (chikuzen.mo at gmail dot com)
3 * Copyright (c) 2015 Paul B Mahol
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21#ifndef AVFILTER_CONVOLUTION_H
22#define AVFILTER_CONVOLUTION_H
23#include "avfilter.h"
24
25enum MatrixMode {
26 MATRIX_SQUARE,
27 MATRIX_ROW,
28 MATRIX_COLUMN,
29 MATRIX_NBMODES,
30};
31
32typedef struct ConvolutionContext {
33 const AVClass *class;
34
35 char *matrix_str[4];
36 float rdiv[4];
37 float bias[4];
38 int mode[4];
39 float scale;
40 float delta;
41 int planes;
42
43 int size[4];
44 int depth;
45 int max;
46 int bpc;
47 int nb_planes;
48 int nb_threads;
49 int planewidth[4];
50 int planeheight[4];
51 int matrix[4][49];
52 int matrix_length[4];
53 int copy[4];
54
55 void (*setup[4])(int radius, const uint8_t *c[], const uint8_t *src, int stride,
56 int x, int width, int y, int height, int bpc);
57 void (*filter[4])(uint8_t *dst, int width,
58 float rdiv, float bias, const int *const matrix,
59 const uint8_t *c[], int peak, int radius,
60 int dstride, int stride);
61} ConvolutionContext;
62
63void ff_convolution_init_x86(ConvolutionContext *s);
64#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t