|
|
|
@ -45,6 +45,7 @@ typedef struct MixContext { |
|
|
|
|
|
|
|
|
|
int depth; |
|
|
|
|
int max; |
|
|
|
|
int planes; |
|
|
|
|
int nb_planes; |
|
|
|
|
int linesize[4]; |
|
|
|
|
int height[4]; |
|
|
|
@ -147,6 +148,14 @@ static int mix_frames(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) |
|
|
|
|
const int slice_end = (s->height[p] * (jobnr+1)) / nb_jobs; |
|
|
|
|
uint8_t *dst = out->data[p] + slice_start * out->linesize[p]; |
|
|
|
|
|
|
|
|
|
if (!((1 << p) & s->planes)) { |
|
|
|
|
av_image_copy_plane(dst, out->linesize[p], |
|
|
|
|
in[0]->data[p] + slice_start * in[0]->linesize[p], |
|
|
|
|
in[0]->linesize[p], |
|
|
|
|
s->linesize[p], slice_end - slice_start); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (y = slice_start; y < slice_end; y++) { |
|
|
|
|
for (x = 0; x < s->linesize[p]; x++) { |
|
|
|
|
float val = 0.f; |
|
|
|
@ -169,6 +178,14 @@ static int mix_frames(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) |
|
|
|
|
const int slice_end = (s->height[p] * (jobnr+1)) / nb_jobs; |
|
|
|
|
uint16_t *dst = (uint16_t *)(out->data[p] + slice_start * out->linesize[p]); |
|
|
|
|
|
|
|
|
|
if (!((1 << p) & s->planes)) { |
|
|
|
|
av_image_copy_plane((uint8_t *)dst, out->linesize[p], |
|
|
|
|
in[0]->data[p] + slice_start * in[0]->linesize[p], |
|
|
|
|
in[0]->linesize[p], |
|
|
|
|
s->linesize[p], slice_end - slice_start); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (y = slice_start; y < slice_end; y++) { |
|
|
|
|
for (x = 0; x < s->linesize[p] / 2; x++) { |
|
|
|
|
float val = 0.f; |
|
|
|
@ -331,6 +348,7 @@ static const AVOption mix_options[] = { |
|
|
|
|
{ "inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=2}, 2, INT16_MAX, .flags = FLAGS }, |
|
|
|
|
{ "weights", "set weight for each input", OFFSET(weights_str), AV_OPT_TYPE_STRING, {.str="1 1"}, 0, 0, .flags = TFLAGS }, |
|
|
|
|
{ "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, INT16_MAX, .flags = TFLAGS }, |
|
|
|
|
{ "planes", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=15}, 0, 15, .flags = TFLAGS }, |
|
|
|
|
{ "duration", "how to determine end of stream", OFFSET(duration), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, .flags = FLAGS, "duration" }, |
|
|
|
|
{ "longest", "Duration of longest input", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "duration" }, |
|
|
|
|
{ "shortest", "Duration of shortest input", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "duration" }, |
|
|
|
@ -413,6 +431,7 @@ static const AVOption tmix_options[] = { |
|
|
|
|
{ "frames", "set number of successive frames to mix", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=3}, 1, 1024, .flags = FLAGS }, |
|
|
|
|
{ "weights", "set weight for each frame", OFFSET(weights_str), AV_OPT_TYPE_STRING, {.str="1 1 1"}, 0, 0, .flags = TFLAGS }, |
|
|
|
|
{ "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, INT16_MAX, .flags = TFLAGS }, |
|
|
|
|
{ "planes", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=15}, 0, 15, .flags = TFLAGS }, |
|
|
|
|
{ NULL }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|