diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-02-17 08:54:39 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-02-17 09:07:30 +0100 |
commit | d151166fe1f98ad534e560eee2cf4bed0c3f1af6 (patch) | |
tree | 75f5192dd504e8db9b2433575ce473be7d5eeb41 /libavfilter/vf_mix.c | |
parent | 2d87cae55c77dad0676aa25ddcb17c0ad18fb5d7 (diff) | |
download | ffmpeg-d151166fe1f98ad534e560eee2cf4bed0c3f1af6.tar.gz |
avfilter/vf_mix: add missing float format support
Diffstat (limited to 'libavfilter/vf_mix.c')
-rw-r--r-- | libavfilter/vf_mix.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c index 5b093d2427..9f29efe254 100644 --- a/libavfilter/vf_mix.c +++ b/libavfilter/vf_mix.c @@ -172,7 +172,7 @@ static int mix_frames(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) dst += out->linesize[p]; } } - } else { + } else if (s->depth <= 16) { for (p = 0; p < s->nb_planes; p++) { const int slice_start = (s->height[p] * jobnr) / nb_jobs; const int slice_end = (s->height[p] * (jobnr+1)) / nb_jobs; @@ -202,6 +202,37 @@ static int mix_frames(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) dst += out->linesize[p] / 2; } } + } else { + for (p = 0; p < s->nb_planes; p++) { + const int slice_start = (s->height[p] * jobnr) / nb_jobs; + const int slice_end = (s->height[p] * (jobnr+1)) / nb_jobs; + float *dst = (float *)(out->data[p] + slice_start * out->linesize[p]); + ptrdiff_t dst_linesize = out->linesize[p] / 4; + + 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; + + for (i = 0; i < s->nb_inputs; i++) { + float src = *(float *)(in[i]->data[p] + y * in[i]->linesize[p] + x * 4); + + val += src * weights[i]; + } + + dst[x] = val * s->wfactor; + } + + dst += dst_linesize; + } + } } return 0; |