From patchwork Fri Jun 5 13:58:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20162 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 97C1744AC97 for ; Fri, 5 Jun 2020 17:06:19 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 746BA68A71D; Fri, 5 Jun 2020 17:06:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A714668A353 for ; Fri, 5 Jun 2020 17:06:12 +0300 (EEST) Received: by mail-pf1-f196.google.com with SMTP id a127so4936367pfa.12 for ; Fri, 05 Jun 2020 07:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=B2MfB0dMa9OYz1SqEgG6fqbbYhuU0o1P8Sjm/RQG/4w=; b=k+UcxqU3/CHe8uDIFeZnSw8yVkDKJoamGqpBKs8adQ9Rfo/N4sJ6WpB/Movu4EX/n3 1jsBYDyyXu/BOoPi1S9LVC7TpwUsFau+8nIRDZqCh9Y63MLmhoHAfkYZFvdnW5/iLqZk XEctR+rSl1COsnDedxQ+ika9YOaZ8DU18UfoM+egaT7+InDMm9iL5jHtdOSazKl5MkSz bg3GVzwykBPK780YOmh9/iaE/RDuIJXH1+jWSm2JoXyJNBJpVYNlaKP/Jj8xvqHH8m2b EMWuOnLfQcWO4BG6MQyyP9L032/ra/fZtslILmgy0Jj7IXBK7TyiTYXyUI+0RNPKWZ9J 5jZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=B2MfB0dMa9OYz1SqEgG6fqbbYhuU0o1P8Sjm/RQG/4w=; b=DUFX9phikUB6mT0qXzDmPX20Imz0y37IC7RHQBUtAUrGOHnf9RwHKKJBOJKXW7A/pR m3VEbCziw1e8yej4fmYTKylS9JRNmIPORb0C8hGVxFEWbSKCrdS/Q5vrvBlSwhttMqXn LGyF5vt2TtirTpaYnD1Gs9CBFUNrZmqZYUU3vyNawvomUOTvC6SIlwPjBhYUWy0Qag0/ EZr7miZXwBWU/AaT4paIJ9VathV2+MlrBlhXKdyjx6mRJGOYCwg/iJiLYJq0eyamPILW H99GByMaWxn2JtANh4NJkIfWLguWuFFUy1K0wgUNK9FAsTg+9f6s7CNlHPVjbLdFHflC dlTg== X-Gm-Message-State: AOAM530YfLR0T8NEMEBdGltkw7mYiNN1/ifw/MgDBMtfhSmU2/g0t+fs WMs+/q1lYje307blB4a45333emE/ X-Google-Smtp-Source: ABdhPJwd9U7u2Yxy5TH0Cap5rv6ynkdRgZEam3ITY1AzAZOp2KdpEz7tC017wrxXUU5yVyIbyJjAXw== X-Received: by 2002:a62:6001:: with SMTP id u1mr9808163pfb.316.1591365510754; Fri, 05 Jun 2020 06:58:30 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id y23sm8498035pje.3.2020.06.05.06.58.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jun 2020 06:58:29 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 Jun 2020 21:58:00 +0800 Message-Id: <1591365482-12502-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH v4 1/3] avfilter/vf_overlay: support for 8bit and 10bit overlay with macro-based function X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- It's old patch, so rebase and merge into one patch for review, in addition, I have added format for yuv422p10, and fate test case. libavfilter/vf_overlay.c | 417 +++++++++++++++++++++++++---------------------- 1 file changed, 220 insertions(+), 197 deletions(-) diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index b5ab5fb..7f73848 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -441,190 +441,213 @@ static av_always_inline void blend_slice_packed_rgb(AVFilterContext *ctx, } } -static av_always_inline void blend_plane(AVFilterContext *ctx, - AVFrame *dst, const AVFrame *src, - int src_w, int src_h, - int dst_w, int dst_h, - int i, int hsub, int vsub, - int x, int y, - int main_has_alpha, - int dst_plane, - int dst_offset, - int dst_step, - int straight, - int yuv, - int jobnr, - int nb_jobs) -{ - OverlayContext *octx = ctx->priv; - int src_wp = AV_CEIL_RSHIFT(src_w, hsub); - int src_hp = AV_CEIL_RSHIFT(src_h, vsub); - int dst_wp = AV_CEIL_RSHIFT(dst_w, hsub); - int dst_hp = AV_CEIL_RSHIFT(dst_h, vsub); - int yp = y>>vsub; - int xp = x>>hsub; - uint8_t *s, *sp, *d, *dp, *dap, *a, *da, *ap; - int jmax, j, k, kmax; - int slice_start, slice_end; - - j = FFMAX(-yp, 0); - jmax = FFMIN3(-yp + dst_hp, FFMIN(src_hp, dst_hp), yp + src_hp); - - slice_start = j + (jmax * jobnr) / nb_jobs; - slice_end = j + (jmax * (jobnr+1)) / nb_jobs; - - sp = src->data[i] + (slice_start) * src->linesize[i]; - dp = dst->data[dst_plane] - + (yp + slice_start) * dst->linesize[dst_plane] - + dst_offset; - ap = src->data[3] + (slice_start << vsub) * src->linesize[3]; - dap = dst->data[3] + ((yp + slice_start) << vsub) * dst->linesize[3]; - - for (j = slice_start; j < slice_end; j++) { - k = FFMAX(-xp, 0); - d = dp + (xp+k) * dst_step; - s = sp + k; - a = ap + (k<blend_row[i]) { - int c = octx->blend_row[i](d, da, s, a, kmax - k, src->linesize[3]); - - s += c; - d += dst_step * c; - da += (1 << hsub) * c; - a += (1 << hsub) * c; - k += c; - } - for (; k < kmax; k++) { - int alpha_v, alpha_h, alpha; - - // average alpha for color components, improve quality - if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) { - alpha = (a[0] + a[src->linesize[3]] + - a[1] + a[src->linesize[3]+1]) >> 2; - } else if (hsub || vsub) { - alpha_h = hsub && k+1 < src_wp ? - (a[0] + a[1]) >> 1 : a[0]; - alpha_v = vsub && j+1 < src_hp ? - (a[0] + a[src->linesize[3]]) >> 1 : a[0]; - alpha = (alpha_v + alpha_h) >> 1; - } else - alpha = a[0]; - // if the main channel has an alpha channel, alpha has to be calculated - // to create an un-premultiplied (straight) alpha value - if (main_has_alpha && alpha != 0 && alpha != 255) { - // average alpha for color components, improve quality - uint8_t alpha_d; - if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) { - alpha_d = (da[0] + da[dst->linesize[3]] + - da[1] + da[dst->linesize[3]+1]) >> 2; - } else if (hsub || vsub) { - alpha_h = hsub && k+1 < src_wp ? - (da[0] + da[1]) >> 1 : da[0]; - alpha_v = vsub && j+1 < src_hp ? - (da[0] + da[dst->linesize[3]]) >> 1 : da[0]; - alpha_d = (alpha_v + alpha_h) >> 1; - } else - alpha_d = da[0]; - alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d); - } - if (straight) { - *d = FAST_DIV255(*d * (255 - alpha) + *s * alpha); - } else { - if (i && yuv) - *d = av_clip(FAST_DIV255((*d - 128) * (255 - alpha)) + *s - 128, -128, 128) + 128; - else - *d = FFMIN(FAST_DIV255(*d * (255 - alpha)) + *s, 255); - } - s++; - d += dst_step; - da += 1 << hsub; - a += 1 << hsub; - } - dp += dst->linesize[dst_plane]; - sp += src->linesize[i]; - ap += (1 << vsub) * src->linesize[3]; - dap += (1 << vsub) * dst->linesize[3]; - } +#define DEFINE_BLEND_PLANE(depth, nbits) \ +static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext *ctx, \ + AVFrame *dst, const AVFrame *src, \ + int src_w, int src_h, \ + int dst_w, int dst_h, \ + int i, int hsub, int vsub, \ + int x, int y, \ + int main_has_alpha, \ + int dst_plane, \ + int dst_offset, \ + int dst_step, \ + int straight, \ + int yuv, \ + int jobnr, \ + int nb_jobs) \ +{ \ + OverlayContext *octx = ctx->priv; \ + int src_wp = AV_CEIL_RSHIFT(src_w, hsub); \ + int src_hp = AV_CEIL_RSHIFT(src_h, vsub); \ + int dst_wp = AV_CEIL_RSHIFT(dst_w, hsub); \ + int dst_hp = AV_CEIL_RSHIFT(dst_h, vsub); \ + int yp = y>>vsub; \ + int xp = x>>hsub; \ + uint##depth##_t *s, *sp, *d, *dp, *dap, *a, *da, *ap; \ + int jmax, j, k, kmax; \ + int slice_start, slice_end; \ + const uint##depth##_t max = (1 << nbits) - 1; \ + const uint##depth##_t mid = (1 << (nbits -1)) ; \ + int bytes = depth / 8; \ + \ + dst_step /= bytes; \ + j = FFMAX(-yp, 0); \ + jmax = FFMIN3(-yp + dst_hp, FFMIN(src_hp, dst_hp), yp + src_hp); \ + \ + slice_start = j + (jmax * jobnr) / nb_jobs; \ + slice_end = j + (jmax * (jobnr+1)) / nb_jobs; \ + \ + sp = (uint##depth##_t *)(src->data[i] + (slice_start) * src->linesize[i]); \ + dp = (uint##depth##_t *)(dst->data[dst_plane] \ + + (yp + slice_start) * dst->linesize[dst_plane] \ + + dst_offset); \ + ap = (uint##depth##_t *)(src->data[3] + (slice_start << vsub) * src->linesize[3]); \ + dap = (uint##depth##_t *)(dst->data[3] + ((yp + slice_start) << vsub) * dst->linesize[3]); \ + \ + for (j = slice_start; j < slice_end; j++) { \ + k = FFMAX(-xp, 0); \ + d = dp + (xp+k) * dst_step; \ + s = sp + k; \ + a = ap + (k<blend_row[i]) { \ + int c = octx->blend_row[i]((uint8_t*)d, (uint8_t*)da, (uint8_t*)s, \ + (uint8_t*)a, kmax - k, src->linesize[3]); \ + \ + s += c; \ + d += dst_step * c; \ + da += (1 << hsub) * c; \ + a += (1 << hsub) * c; \ + k += c; \ + } \ + for (; k < kmax; k++) { \ + int alpha_v, alpha_h, alpha; \ + \ + /* average alpha for color components, improve quality */ \ + if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) { \ + alpha = (a[0] + a[src->linesize[3]] + \ + a[1] + a[src->linesize[3]+1]) >> 2; \ + } else if (hsub || vsub) { \ + alpha_h = hsub && k+1 < src_wp ? \ + (a[0] + a[1]) >> 1 : a[0]; \ + alpha_v = vsub && j+1 < src_hp ? \ + (a[0] + a[src->linesize[3]]) >> 1 : a[0]; \ + alpha = (alpha_v + alpha_h) >> 1; \ + } else \ + alpha = a[0]; \ + /* if the main channel has an alpha channel, alpha has to be calculated */ \ + /* to create an un-premultiplied (straight) alpha value */ \ + if (main_has_alpha && alpha != 0 && alpha != max) { \ + /* average alpha for color components, improve quality */ \ + uint8_t alpha_d; \ + if (hsub && vsub && j+1 < src_hp && k+1 < src_wp) { \ + alpha_d = (da[0] + da[dst->linesize[3]] + \ + da[1] + da[dst->linesize[3]+1]) >> 2; \ + } else if (hsub || vsub) { \ + alpha_h = hsub && k+1 < src_wp ? \ + (da[0] + da[1]) >> 1 : da[0]; \ + alpha_v = vsub && j+1 < src_hp ? \ + (da[0] + da[dst->linesize[3]]) >> 1 : da[0]; \ + alpha_d = (alpha_v + alpha_h) >> 1; \ + } else \ + alpha_d = da[0]; \ + alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d); \ + } \ + if (straight) { \ + if (nbits > 8) \ + *d = (*d * (max - alpha) + *s * alpha) / max; \ + else \ + *d = FAST_DIV255(*d * (255 - alpha) + *s * alpha); \ + } else { \ + if (nbits > 8) { \ + if (i && yuv) \ + *d = av_clip((*d * (max - alpha) + *s * alpha) / max + *s - mid, -mid, mid) + mid; \ + else \ + *d = FFMIN((*d * (max - alpha) + *s * alpha) / max + *s, max); \ + } else { \ + if (i && yuv) \ + *d = av_clip(FAST_DIV255((*d - mid) * (max - alpha)) + *s - mid, -mid, mid) + mid; \ + else \ + *d = FFMIN(FAST_DIV255(*d * (max - alpha)) + *s, max); \ + } \ + } \ + s++; \ + d += dst_step; \ + da += 1 << hsub; \ + a += 1 << hsub; \ + } \ + dp += dst->linesize[dst_plane] / bytes; \ + sp += src->linesize[i] / bytes; \ + ap += (1 << vsub) * src->linesize[3] / bytes; \ + dap += (1 << vsub) * dst->linesize[3] / bytes; \ + } \ } - -static inline void alpha_composite(const AVFrame *src, const AVFrame *dst, - int src_w, int src_h, - int dst_w, int dst_h, - int x, int y, - int jobnr, int nb_jobs) -{ - uint8_t alpha; ///< the amount of overlay to blend on to main - uint8_t *s, *sa, *d, *da; - int i, imax, j, jmax; - int slice_start, slice_end; - - imax = FFMIN(-y + dst_h, src_h); - slice_start = (imax * jobnr) / nb_jobs; - slice_end = ((imax * (jobnr+1)) / nb_jobs); - - i = FFMAX(-y, 0); - sa = src->data[3] + (i + slice_start) * src->linesize[3]; - da = dst->data[3] + (y + i + slice_start) * dst->linesize[3]; - - for (i = i + slice_start; i < slice_end; i++) { - j = FFMAX(-x, 0); - s = sa + j; - d = da + x+j; - - for (jmax = FFMIN(-x + dst_w, src_w); j < jmax; j++) { - alpha = *s; - if (alpha != 0 && alpha != 255) { - uint8_t alpha_d = *d; - alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d); - } - switch (alpha) { - case 0: - break; - case 255: - *d = *s; - break; - default: - // apply alpha compositing: main_alpha += (1-main_alpha) * overlay_alpha - *d += FAST_DIV255((255 - *d) * *s); - } - d += 1; - s += 1; - } - da += dst->linesize[3]; - sa += src->linesize[3]; - } +DEFINE_BLEND_PLANE(8, 8); + +#define DEFINE_ALPHA_COMPOSITE(depth, nbits) \ +static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame *src, const AVFrame *dst, \ + int src_w, int src_h, \ + int dst_w, int dst_h, \ + int x, int y, \ + int jobnr, int nb_jobs) \ +{ \ + uint##depth##_t alpha; /* the amount of overlay to blend on to main */ \ + uint##depth##_t *s, *sa, *d, *da; \ + int i, imax, j, jmax; \ + int slice_start, slice_end; \ + const uint##depth##_t max = (1 << nbits) - 1; \ + int bytes = depth / 8; \ + \ + imax = FFMIN(-y + dst_h, src_h); \ + slice_start = (imax * jobnr) / nb_jobs; \ + slice_end = ((imax * (jobnr+1)) / nb_jobs); \ + \ + i = FFMAX(-y, 0); \ + sa = (uint##depth##_t *)(src->data[3] + (i + slice_start) * src->linesize[3]); \ + da = (uint##depth##_t *)(dst->data[3] + (y + i + slice_start) * dst->linesize[3]); \ + \ + for (i = i + slice_start; i < slice_end; i++) { \ + j = FFMAX(-x, 0); \ + s = sa + j; \ + d = da + x+j; \ + \ + for (jmax = FFMIN(-x + dst_w, src_w); j < jmax; j++) { \ + alpha = *s; \ + if (alpha != 0 && alpha != max) { \ + uint8_t alpha_d = *d; \ + alpha = UNPREMULTIPLY_ALPHA(alpha, alpha_d); \ + } \ + if (alpha == max) \ + *d = *s; \ + else if (alpha > 0) { \ + /* apply alpha compositing: main_alpha += (1-main_alpha) * overlay_alpha */ \ + if (nbits > 8) \ + *d += (max - *d) * *s / max; \ + else \ + *d += FAST_DIV255((max - *d) * *s); \ + } \ + d += 1; \ + s += 1; \ + } \ + da += dst->linesize[3] / bytes; \ + sa += src->linesize[3] / bytes; \ + } \ } - -static av_always_inline void blend_slice_yuv(AVFilterContext *ctx, - AVFrame *dst, const AVFrame *src, - int hsub, int vsub, - int main_has_alpha, - int x, int y, - int is_straight, - int jobnr, int nb_jobs) -{ - OverlayContext *s = ctx->priv; - const int src_w = src->width; - const int src_h = src->height; - const int dst_w = dst->width; - const int dst_h = dst->height; - - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha, - s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, s->main_desc->comp[0].step, is_straight, 1, - jobnr, nb_jobs); - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha, - s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, s->main_desc->comp[1].step, is_straight, 1, - jobnr, nb_jobs); - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha, - s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, s->main_desc->comp[2].step, is_straight, 1, - jobnr, nb_jobs); - - if (main_has_alpha) - alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, nb_jobs); +DEFINE_ALPHA_COMPOSITE(8, 8); + +#define DEFINE_BLEND_SLICE_YUV(depth, nbits) \ +static av_always_inline void blend_slice_yuv_##depth##_##nbits##bits(AVFilterContext *ctx, \ + AVFrame *dst, const AVFrame *src, \ + int hsub, int vsub, \ + int main_has_alpha, \ + int x, int y, \ + int is_straight, \ + int jobnr, int nb_jobs) \ +{ \ + OverlayContext *s = ctx->priv; \ + const int src_w = src->width; \ + const int src_h = src->height; \ + const int dst_w = dst->width; \ + const int dst_h = dst->height; \ + \ + blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, \ + x, y, main_has_alpha, s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, \ + s->main_desc->comp[0].step, is_straight, 1, jobnr, nb_jobs); \ + blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, \ + x, y, main_has_alpha, s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, \ + s->main_desc->comp[1].step, is_straight, 1, jobnr, nb_jobs); \ + blend_plane_##depth##_##nbits##bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, \ + x, y, main_has_alpha, s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, \ + s->main_desc->comp[2].step, is_straight, 1, jobnr, nb_jobs); \ + \ + if (main_has_alpha) \ + alpha_composite_##depth##_##nbits##bits(src, dst, src_w, src_h, dst_w, dst_h, x, y, \ + jobnr, nb_jobs); \ } +DEFINE_BLEND_SLICE_YUV(8, 8); static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, @@ -641,25 +664,25 @@ static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx, const int dst_w = dst->width; const int dst_h = dst->height; - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha, + blend_plane_8_8bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 0, 0, 0, x, y, main_has_alpha, s->main_desc->comp[1].plane, s->main_desc->comp[1].offset, s->main_desc->comp[1].step, is_straight, 0, jobnr, nb_jobs); - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha, + blend_plane_8_8bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 1, hsub, vsub, x, y, main_has_alpha, s->main_desc->comp[2].plane, s->main_desc->comp[2].offset, s->main_desc->comp[2].step, is_straight, 0, jobnr, nb_jobs); - blend_plane(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha, + blend_plane_8_8bits(ctx, dst, src, src_w, src_h, dst_w, dst_h, 2, hsub, vsub, x, y, main_has_alpha, s->main_desc->comp[0].plane, s->main_desc->comp[0].offset, s->main_desc->comp[0].step, is_straight, 0, jobnr, nb_jobs); if (main_has_alpha) - alpha_composite(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, nb_jobs); + alpha_composite_8_8bits(src, dst, src_w, src_h, dst_w, dst_h, x, y, jobnr, nb_jobs); } static int blend_slice_yuv420(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 1, 1, 0, s->x, s->y, 1, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 1, 1, 0, s->x, s->y, 1, jobnr, nb_jobs); return 0; } @@ -667,7 +690,7 @@ static int blend_slice_yuva420(AVFilterContext *ctx, void *arg, int jobnr, int n { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 1, 1, 1, s->x, s->y, 1, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 1, 1, 1, s->x, s->y, 1, jobnr, nb_jobs); return 0; } @@ -675,7 +698,7 @@ static int blend_slice_yuv422(AVFilterContext *ctx, void *arg, int jobnr, int nb { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 1, 0, 0, s->x, s->y, 1, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 1, 0, 0, s->x, s->y, 1, jobnr, nb_jobs); return 0; } @@ -683,7 +706,7 @@ static int blend_slice_yuva422(AVFilterContext *ctx, void *arg, int jobnr, int n { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 1, 0, 1, s->x, s->y, 1, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 1, 0, 1, s->x, s->y, 1, jobnr, nb_jobs); return 0; } @@ -691,7 +714,7 @@ static int blend_slice_yuv444(AVFilterContext *ctx, void *arg, int jobnr, int nb { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 0, 0, 0, s->x, s->y, 1, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 0, 0, 0, s->x, s->y, 1, jobnr, nb_jobs); return 0; } @@ -699,7 +722,7 @@ static int blend_slice_yuva444(AVFilterContext *ctx, void *arg, int jobnr, int n { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 0, 0, 1, s->x, s->y, 1, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 0, 0, 1, s->x, s->y, 1, jobnr, nb_jobs); return 0; } @@ -723,7 +746,7 @@ static int blend_slice_yuv420_pm(AVFilterContext *ctx, void *arg, int jobnr, int { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 1, 1, 0, s->x, s->y, 0, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 1, 1, 0, s->x, s->y, 0, jobnr, nb_jobs); return 0; } @@ -731,7 +754,7 @@ static int blend_slice_yuva420_pm(AVFilterContext *ctx, void *arg, int jobnr, in { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 1, 1, 1, s->x, s->y, 0, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 1, 1, 1, s->x, s->y, 0, jobnr, nb_jobs); return 0; } @@ -739,7 +762,7 @@ static int blend_slice_yuv422_pm(AVFilterContext *ctx, void *arg, int jobnr, int { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 1, 0, 0, s->x, s->y, 0, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 1, 0, 0, s->x, s->y, 0, jobnr, nb_jobs); return 0; } @@ -747,7 +770,7 @@ static int blend_slice_yuva422_pm(AVFilterContext *ctx, void *arg, int jobnr, in { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 1, 0, 1, s->x, s->y, 0, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 1, 0, 1, s->x, s->y, 0, jobnr, nb_jobs); return 0; } @@ -755,7 +778,7 @@ static int blend_slice_yuv444_pm(AVFilterContext *ctx, void *arg, int jobnr, int { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 0, 0, 0, s->x, s->y, 0, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 0, 0, 0, s->x, s->y, 0, jobnr, nb_jobs); return 0; } @@ -763,7 +786,7 @@ static int blend_slice_yuva444_pm(AVFilterContext *ctx, void *arg, int jobnr, in { OverlayContext *s = ctx->priv; ThreadData *td = arg; - blend_slice_yuv(ctx, td->dst, td->src, 0, 0, 1, s->x, s->y, 0, jobnr, nb_jobs); + blend_slice_yuv_8_8bits(ctx, td->dst, td->src, 0, 0, 1, s->x, s->y, 0, jobnr, nb_jobs); return 0; } From patchwork Fri Jun 5 13:58:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20161 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 7625A4492D7 for ; Fri, 5 Jun 2020 17:04:31 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 48916680233; Fri, 5 Jun 2020 17:04:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BD028689AA9 for ; Fri, 5 Jun 2020 17:04:24 +0300 (EEST) Received: by mail-pf1-f196.google.com with SMTP id d66so4953572pfd.6 for ; Fri, 05 Jun 2020 07:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RQ7mIXaK/w8te/kpyL++I9BieNIj2Sbr5ZVKwwG/lX8=; b=cfF/jcqIVV6D0ksm5wHvVD+BRNAyP9cqIsM0dxrSxXjR/RrLafAmeHefHupOQi+OQ5 uXSZVLoxhhjAQp/UVO+P3VUzoPPaILwV8TGMSlcBzUd1fT6Cyexj4j1dpNizV24QbTQN R6Gft9UJYCUFytht2ySBUb9zFPxwoJ/r3KEDms8qmG4ldaysO4+MW1Y9neV0cCnAhv+1 nGTjWFwePvqg0sH6P/8COk/MhWJeT6v4y2HhjoRCz4u21OYCn+NxgnIPAZZ1aBZ2Xgey qHxMXiDKds0lllpaBsngLeq92iFaWJEChhwiKhZMg8FS3Qg895ICSAXZi/5xd/mHAmtU ydKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RQ7mIXaK/w8te/kpyL++I9BieNIj2Sbr5ZVKwwG/lX8=; b=JY7gsNWV4X13Z7kUHh+ifMjoUFeZQVMQYexzRq5OACUMIKsb3afYiA28HX1mg1BGyM cMf+K//MWCOG+1GZaID6GGHnP/h0HK+0RJp6WbPKNcNH6jspT/ZDyRLnL+GjySl3vwsj P8lLo7FOcyLGS3K2AevBeAecKU8n66q0DJ/5jPxvZAjKnEmhXeTKxulmlNJgNcF09JS5 Fnn5vGVAW/njbysTouqtdYJ1IGrYZmeej26fid+a/8VFVVYCv2yLq5XE0ouf75IwVLVr SMBdoIvN42bn7pwCjul2Xvw7xduyMBQw0rYqq7kQTHaK8Mw/Z5A77mWDKhPFSs9kkhf8 wJ8A== X-Gm-Message-State: AOAM530JLLyuYdRei9cGLJa6nrjB/4Xx+nl63WzUa3OoP5M2kqKbPcjT rd2CuEo8y+rtvdWht52uAalVueBu X-Google-Smtp-Source: ABdhPJwD/0+ro+2IQROc5CrJWCwArSas0u4dnlS535QcRYpIZxKSeomcQ5CTwCeZnzWM4aKw0AXHww== X-Received: by 2002:a63:c311:: with SMTP id c17mr9752460pgd.103.1591365513534; Fri, 05 Jun 2020 06:58:33 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id y23sm8498035pje.3.2020.06.05.06.58.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jun 2020 06:58:33 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 Jun 2020 21:58:01 +0800 Message-Id: <1591365482-12502-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1591365482-12502-1-git-send-email-lance.lmwang@gmail.com> References: <1591365482-12502-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v4 2/3] avfilter/vf_overlay: add yuv420p10 and yuv422p10 10bit format support X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 6 ++++ libavfilter/vf_overlay.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ libavfilter/vf_overlay.h | 2 ++ 3 files changed, 87 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index f76604c..4c54325 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -14342,9 +14342,15 @@ It accepts the following values: @item yuv420 force YUV420 output +@item yuv420p10 +force YUV420p10 output + @item yuv422 force YUV422 output +@item yuv422p10 +force YUV422p10 output + @item yuv444 force YUV444 output diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 7f73848..5ab3f3f 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -154,6 +154,7 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar static const enum AVPixelFormat alpha_pix_fmts[] = { AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, + AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE }; @@ -172,6 +173,14 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE }; + static const enum AVPixelFormat main_pix_fmts_yuv420p10[] = { + AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUVA420P10, + AV_PIX_FMT_NONE + }; + static const enum AVPixelFormat overlay_pix_fmts_yuv420p10[] = { + AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_NONE + }; + static const enum AVPixelFormat main_pix_fmts_yuv422[] = { AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_NONE }; @@ -179,6 +188,13 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA422P, AV_PIX_FMT_NONE }; + static const enum AVPixelFormat main_pix_fmts_yuv422p10[] = { + AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_NONE + }; + static const enum AVPixelFormat overlay_pix_fmts_yuv422p10[] = { + AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_NONE + }; + static const enum AVPixelFormat main_pix_fmts_yuv444[] = { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_NONE }; @@ -217,6 +233,13 @@ static int query_formats(AVFilterContext *ctx) goto fail; } break; + case OVERLAY_FORMAT_YUV420P10: + if (!(main_formats = ff_make_format_list(main_pix_fmts_yuv420p10)) || + !(overlay_formats = ff_make_format_list(overlay_pix_fmts_yuv420p10))) { + ret = AVERROR(ENOMEM); + goto fail; + } + break; case OVERLAY_FORMAT_YUV422: if (!(main_formats = ff_make_format_list(main_pix_fmts_yuv422)) || !(overlay_formats = ff_make_format_list(overlay_pix_fmts_yuv422))) { @@ -224,6 +247,13 @@ static int query_formats(AVFilterContext *ctx) goto fail; } break; + case OVERLAY_FORMAT_YUV422P10: + if (!(main_formats = ff_make_format_list(main_pix_fmts_yuv422p10)) || + !(overlay_formats = ff_make_format_list(overlay_pix_fmts_yuv422p10))) { + ret = AVERROR(ENOMEM); + goto fail; + } + break; case OVERLAY_FORMAT_YUV444: if (!(main_formats = ff_make_format_list(main_pix_fmts_yuv444)) || !(overlay_formats = ff_make_format_list(overlay_pix_fmts_yuv444))) { @@ -566,6 +596,7 @@ static av_always_inline void blend_plane_##depth##_##nbits##bits(AVFilterContext } \ } DEFINE_BLEND_PLANE(8, 8); +DEFINE_BLEND_PLANE(16, 10); #define DEFINE_ALPHA_COMPOSITE(depth, nbits) \ static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame *src, const AVFrame *dst, \ @@ -617,6 +648,7 @@ static inline void alpha_composite_##depth##_##nbits##bits(const AVFrame *src, c } \ } DEFINE_ALPHA_COMPOSITE(8, 8); +DEFINE_ALPHA_COMPOSITE(16, 10); #define DEFINE_BLEND_SLICE_YUV(depth, nbits) \ static av_always_inline void blend_slice_yuv_##depth##_##nbits##bits(AVFilterContext *ctx, \ @@ -648,6 +680,7 @@ static av_always_inline void blend_slice_yuv_##depth##_##nbits##bits(AVFilterCon jobnr, nb_jobs); \ } DEFINE_BLEND_SLICE_YUV(8, 8); +DEFINE_BLEND_SLICE_YUV(16, 10); static av_always_inline void blend_slice_planar_rgb(AVFilterContext *ctx, AVFrame *dst, const AVFrame *src, @@ -694,6 +727,38 @@ static int blend_slice_yuva420(AVFilterContext *ctx, void *arg, int jobnr, int n return 0; } +static int blend_slice_yuv420p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + OverlayContext *s = ctx->priv; + ThreadData *td = arg; + blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 1, 1, 0, s->x, s->y, 1, jobnr, nb_jobs); + return 0; +} + +static int blend_slice_yuva420p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + OverlayContext *s = ctx->priv; + ThreadData *td = arg; + blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 1, 1, 1, s->x, s->y, 1, jobnr, nb_jobs); + return 0; +} + +static int blend_slice_yuv422p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + OverlayContext *s = ctx->priv; + ThreadData *td = arg; + blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 1, 0, 0, s->x, s->y, 1, jobnr, nb_jobs); + return 0; +} + +static int blend_slice_yuva422p10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) +{ + OverlayContext *s = ctx->priv; + ThreadData *td = arg; + blend_slice_yuv_16_10bits(ctx, td->dst, td->src, 1, 0, 1, s->x, s->y, 1, jobnr, nb_jobs); + return 0; +} + static int blend_slice_yuv422(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { OverlayContext *s = ctx->priv; @@ -857,9 +922,15 @@ static int config_input_main(AVFilterLink *inlink) case OVERLAY_FORMAT_YUV420: s->blend_slice = s->main_has_alpha ? blend_slice_yuva420 : blend_slice_yuv420; break; + case OVERLAY_FORMAT_YUV420P10: + s->blend_slice = s->main_has_alpha ? blend_slice_yuva420p10 : blend_slice_yuv420p10; + break; case OVERLAY_FORMAT_YUV422: s->blend_slice = s->main_has_alpha ? blend_slice_yuva422 : blend_slice_yuv422; break; + case OVERLAY_FORMAT_YUV422P10: + s->blend_slice = s->main_has_alpha ? blend_slice_yuva422p10 : blend_slice_yuv422p10; + break; case OVERLAY_FORMAT_YUV444: s->blend_slice = s->main_has_alpha ? blend_slice_yuva444 : blend_slice_yuv444; break; @@ -874,9 +945,15 @@ static int config_input_main(AVFilterLink *inlink) case AV_PIX_FMT_YUVA420P: s->blend_slice = blend_slice_yuva420; break; + case AV_PIX_FMT_YUVA420P10: + s->blend_slice = blend_slice_yuva420p10; + break; case AV_PIX_FMT_YUVA422P: s->blend_slice = blend_slice_yuva422; break; + case AV_PIX_FMT_YUVA422P10: + s->blend_slice = blend_slice_yuva422p10; + break; case AV_PIX_FMT_YUVA444P: s->blend_slice = blend_slice_yuva444; break; @@ -1028,7 +1105,9 @@ static const AVOption overlay_options[] = { { "shortest", "force termination when the shortest input terminates", OFFSET(fs.opt_shortest), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { "format", "set output format", OFFSET(format), AV_OPT_TYPE_INT, {.i64=OVERLAY_FORMAT_YUV420}, 0, OVERLAY_FORMAT_NB-1, FLAGS, "format" }, { "yuv420", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV420}, .flags = FLAGS, .unit = "format" }, + { "yuv420p10", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV420P10}, .flags = FLAGS, .unit = "format" }, { "yuv422", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422}, .flags = FLAGS, .unit = "format" }, + { "yuv422p10", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV422P10}, .flags = FLAGS, .unit = "format" }, { "yuv444", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_YUV444}, .flags = FLAGS, .unit = "format" }, { "rgb", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_RGB}, .flags = FLAGS, .unit = "format" }, { "gbrp", "", 0, AV_OPT_TYPE_CONST, {.i64=OVERLAY_FORMAT_GBRP}, .flags = FLAGS, .unit = "format" }, diff --git a/libavfilter/vf_overlay.h b/libavfilter/vf_overlay.h index 98b06ea..30a1a73 100644 --- a/libavfilter/vf_overlay.h +++ b/libavfilter/vf_overlay.h @@ -41,7 +41,9 @@ enum var_name { enum OverlayFormat { OVERLAY_FORMAT_YUV420, + OVERLAY_FORMAT_YUV420P10, OVERLAY_FORMAT_YUV422, + OVERLAY_FORMAT_YUV422P10, OVERLAY_FORMAT_YUV444, OVERLAY_FORMAT_RGB, OVERLAY_FORMAT_GBRP, From patchwork Fri Jun 5 13:58:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20160 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EFDD0448BDF for ; Fri, 5 Jun 2020 16:58:44 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CC66768B15A; Fri, 5 Jun 2020 16:58:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5C63568B0BA for ; Fri, 5 Jun 2020 16:58:38 +0300 (EEST) Received: by mail-pj1-f46.google.com with SMTP id k2so2622155pjs.2 for ; Fri, 05 Jun 2020 06:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8V8j2qJjxtvvFZHPGE12ZbBm7ckwy+C01Ci0Pmc8KtU=; b=f2Rw9SxDMqcy98HhFovEMnKjSa5H2Vtt3OU+a/6he18K8Vj1cQ63Qlan1x2xeZANYp xbT0FuWTPd4oZbmB0+YS7eVubgT0ANnsVHit2pSj4NjwnMR4v660p/IXtXqt+IxG/mo0 TBW8/kEXh/7wmxZcsgfXJEHqaHPwihXfIEdc2zvaU/Uu9SJgQtUjiv3hcfyyJnbyVvIx LjT1UqteUyffk8EygqFk8jp7edwOdGdsXZOhFcBacvk0fHxUQ+5HikqfnCU0aTdGFOT5 0IPg8dhJJtI5truLmIF1uGz+nUsCNGt/5D5CAqgFSvsJz0gBPBFg+xdn8dO1OOm8upaf hbQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8V8j2qJjxtvvFZHPGE12ZbBm7ckwy+C01Ci0Pmc8KtU=; b=hoA56mr1bcwWMRzh/XImzuHkGkmCDmW6bCx++abd2xb8AP/Cp7x2vbfOpWFSrAY7Z5 l8JjdsEmduHmncc5dgc59TCFXHFyQFAuBJ6Vqu8h28Ntg163GjB9CgfnthXL+Y0h5ICG Wje6VJn0xHBAXgphgvADMtwu26Ea2lp2W9HsY+T7s+ttZqSC0Uz8Sq7aUol0lqw+H9Fp VN+Fq9GG1gq0j6tnZlw7YiGTVQmsKzJixpSFGLyD7ZFjteHOtzfUribCHz+JR9oy1Hut Cpwc3AYw6IOmTVPeloh2kbJFz4DJyaYaly4FdTWcJJBlKz9DRQOUU2VsFEZfJAyD7wwE LJ8w== X-Gm-Message-State: AOAM532oWQuv8ajmQ6cx6chvMIub6pEhOXZZrJXWcsQfKnZTZF3PR1v7 /XKIxHKmp3ug46bUqPEnvsMsk4Y5 X-Google-Smtp-Source: ABdhPJzRNbKNGQcScrqBGIKzLTsM9fiDnQcAgHoceEqm2if7DViJocALqgNwbRV79Vi9j8S048jQjg== X-Received: by 2002:a17:90a:7787:: with SMTP id v7mr3330079pjk.199.1591365516230; Fri, 05 Jun 2020 06:58:36 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id y23sm8498035pje.3.2020.06.05.06.58.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jun 2020 06:58:35 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 Jun 2020 21:58:02 +0800 Message-Id: <1591365482-12502-3-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1591365482-12502-1-git-send-email-lance.lmwang@gmail.com> References: <1591365482-12502-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v4 3/3] fate: add yuv420p10 and yuv422p10 tests for overlay filter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- tests/fate/filter-video.mak | 8 ++++++++ tests/filtergraphs/overlay_yuv420p10 | 5 +++++ tests/filtergraphs/overlay_yuv422p10 | 5 +++++ tests/ref/fate/filter-overlay_yuv420p10 | 8 ++++++++ tests/ref/fate/filter-overlay_yuv422p10 | 8 ++++++++ 5 files changed, 34 insertions(+) create mode 100644 tests/filtergraphs/overlay_yuv420p10 create mode 100644 tests/filtergraphs/overlay_yuv422p10 create mode 100644 tests/ref/fate/filter-overlay_yuv420p10 create mode 100644 tests/ref/fate/filter-overlay_yuv422p10 diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index cfeb53e..def6079 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -223,6 +223,10 @@ FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_F fate-filter-overlay_yuv420: tests/data/filtergraphs/overlay_yuv420 fate-filter-overlay_yuv420: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_yuv420 +FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_yuv420p10 +fate-filter-overlay_yuv420p10: tests/data/filtergraphs/overlay_yuv420p10 +fate-filter-overlay_yuv420p10: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_yuv420p10 -frames:v 3 + FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_nv12 fate-filter-overlay_nv12: tests/data/filtergraphs/overlay_nv12 fate-filter-overlay_nv12: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_nv12 @@ -237,6 +241,10 @@ FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_F fate-filter-overlay_yuv422: tests/data/filtergraphs/overlay_yuv422 fate-filter-overlay_yuv422: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_yuv422 +FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_yuv422p10 +fate-filter-overlay_yuv422p10: tests/data/filtergraphs/overlay_yuv422p10 +fate-filter-overlay_yuv422p10: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_yuv422p10 -frames:v 3 + FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_yuv444 fate-filter-overlay_yuv444: tests/data/filtergraphs/overlay_yuv444 fate-filter-overlay_yuv444: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_yuv444 diff --git a/tests/filtergraphs/overlay_yuv420p10 b/tests/filtergraphs/overlay_yuv420p10 new file mode 100644 index 0000000..7cc9dcb --- /dev/null +++ b/tests/filtergraphs/overlay_yuv420p10 @@ -0,0 +1,5 @@ +sws_flags=+accurate_rnd+bitexact; +split [main][over]; +[over] scale=88:72, pad=96:80:4:4 [overf]; +[main] format=yuv420p10 [mainf]; +[mainf][overf] overlay=240:16:format=yuv420p10 diff --git a/tests/filtergraphs/overlay_yuv422p10 b/tests/filtergraphs/overlay_yuv422p10 new file mode 100644 index 0000000..459d140 --- /dev/null +++ b/tests/filtergraphs/overlay_yuv422p10 @@ -0,0 +1,5 @@ +sws_flags=+accurate_rnd+bitexact; +split [main][over]; +[over] scale=88:72, pad=96:80:4:4 [overf]; +[main] format=yuv420p10 [mainf]; +[mainf][overf] overlay=240:16:format=yuv422p10 diff --git a/tests/ref/fate/filter-overlay_yuv420p10 b/tests/ref/fate/filter-overlay_yuv420p10 new file mode 100644 index 0000000..cc90fb5 --- /dev/null +++ b/tests/ref/fate/filter-overlay_yuv420p10 @@ -0,0 +1,8 @@ +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 352x288 +#sar 0: 0/1 +0, 0, 0, 1, 304128, 0x85348342 +0, 1, 1, 1, 304128, 0x2871d7dc +0, 2, 2, 1, 304128, 0x75819b2a diff --git a/tests/ref/fate/filter-overlay_yuv422p10 b/tests/ref/fate/filter-overlay_yuv422p10 new file mode 100644 index 0000000..a601931 --- /dev/null +++ b/tests/ref/fate/filter-overlay_yuv422p10 @@ -0,0 +1,8 @@ +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 352x288 +#sar 0: 0/1 +0, 0, 0, 1, 608256, 0x8e3fe595 +0, 1, 1, 1, 608256, 0x38512396 +0, 2, 2, 1, 608256, 0x0195cb34