Skip to content

Commit 9e7130f

Browse files
cabirdmexiaoxial
authored andcommitted
updated ffmpeg plugin to support avx2. attempt 2
1 parent 4ed50d0 commit 9e7130f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

ffmpeg/vf_raisr.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ typedef struct RaisrContext
6868
int blending;
6969
int passes;
7070
int mode;
71+
char *asmStr;
7172

7273
struct plane_info inplanes[3];
7374
int nb_planes;
@@ -85,6 +86,7 @@ static const AVOption raisr_options[] = {
8586
{"blending", "CT blending mode (1: Randomness, 2: CountOfBitsChanged)", OFFSET(blending), AV_OPT_TYPE_INT, {.i64 = BLENDING_COUNT_OF_BITS_CHANGED}, BLENDING_RANDOMNESS, BLENDING_COUNT_OF_BITS_CHANGED, FLAGS},
8687
{"passes", "passes to run (1: one pass, 2: two pass)", OFFSET(passes), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 2, FLAGS},
8788
{"mode", "mode for two pass (1: upscale in 1st pass, 2: upscale in 2nd pass)", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = 1}, 1, 2, FLAGS},
89+
{"asm", "x86 asm type: (avx512 or avx2)", OFFSET(asmStr), AV_OPT_TYPE_STRING, {.i64 = "avx512"}, 0, 0, FLAGS},
8890
{NULL}};
8991

9092
AVFILTER_DEFINE_CLASS(raisr);
@@ -112,7 +114,17 @@ static av_cold int init(AVFilterContext *ctx)
112114
if (strcmp(raisr->range, "full") == 0)
113115
rangeType = FullRange;
114116

115-
RNLERRORTYPE ret = RNLHandler_Init(basepath, raisr->ratio, raisr->bits, rangeType, raisr->threadcount, AVX512, raisr->passes, raisr->mode);
117+
ASMType asm_t;
118+
if (strcmp(raisr->asmStr, "avx2") == 0)
119+
asm_t = AVX2;
120+
else if (strcmp(raisr->asmStr, "avx512") == 0)
121+
asm_t = AVX512;
122+
else {
123+
av_log(ctx, AV_LOG_VERBOSE, "asm field expects avx2 or avx512 but got: %s\n", raisr->asmStr);
124+
return AVERROR(ENOENT);
125+
}
126+
127+
RNLERRORTYPE ret = RNLHandler_Init(basepath, raisr->ratio, raisr->bits, rangeType, raisr->threadcount, asm_t, raisr->passes, raisr->mode);
116128

117129
if (ret != RNLErrorNone)
118130
{

0 commit comments

Comments
 (0)