From patchwork Sun Jul 26 19:17:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 21273 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 84F3E44B67D for ; Sun, 26 Jul 2020 22:18:06 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 47BDB68B651; Sun, 26 Jul 2020 22:18:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C95F968B06A for ; Sun, 26 Jul 2020 22:17:59 +0300 (EEST) Received: by mail-pf1-f177.google.com with SMTP id a23so7887828pfk.13 for ; Sun, 26 Jul 2020 12:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=b17kITcHzdX78+UD+Ked1Q05kony6JwZLEyj/S3uj3c=; b=AbFH+Zh/3gTLGSM5kItFykIEYifp7nYGJSjLI0zbpuuQENED2WtNoTzRDGF9mMKbdZ Py2GVt42dB2mL3H8eTsgXsz+G/hKHUf2KhYpVszE1wUj7QVZ3/HToECA2s/Lr2CT0zND xPLnN6RWN7tk2lqaQvg2lUvqKMH7BtN0eMiTzFvNH8BFOj/BBo1U6Y2eqCmc/erC8yEs GEENbHGT15NQJ/DQULkh0Rpur9V+vlGbVD3ef0a3ZAI3Ezv//P3iNjBi7z+UwgNlum1n QssvqhsoZgpwlb0Mh8MZgG0h6N7KPXacvyK0SrIFJb/xi2W8wd9qUbnTLlwxdGmdZQKT Mitg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=b17kITcHzdX78+UD+Ked1Q05kony6JwZLEyj/S3uj3c=; b=RtPw2PVYPwY1aJKDrdhGM5D/rlAHVYzHdLmtR8Oo8irZQ0KIBaJE5nf7ynvW+zsNHX Jg8r/SWsFisiuGWbPdMjXVrdff0Q9m9TI7Z7Lp/c7ISRFAgWSJ5N4TKpmc54qB4lGopi dmLENJYSbdjcV5ZMG/tReBe7QU/ERXyYiQVR82Xy7ilgnjs2YGxRdc/+L/w5WgGkDF3i 9ISP+rKcWuYlH09IiSZdgD3g0gzj/DYwhDTY9imvRpwTCPTlQFCwwbq7QAEtjCRtfXwV jse6KnHLl95LDbv+HWeocaJT9DjTO6Os1C2GPRp3/O91gpcAVFVvsPt4K6VTpadSPDkk yS2A== X-Gm-Message-State: AOAM532ikh+MfIwGxBmdnXqUygppPX/o5FChUQQZcUOcJVUDWbquE6sr iAX23jD7zDYdbO/tSIk+V1nu1Ak/ycc2QF4doGnoiiQO X-Google-Smtp-Source: ABdhPJx6ztZDSIGh+dlOFSbCIgnEJzdCKDvwHxtg0QP/SN8TMJvlZb2PLkVN06AnM4N6OFzKUmjHjgyk7cWbt7J/dt0= X-Received: by 2002:a65:448c:: with SMTP id l12mr16470320pgq.234.1595791076948; Sun, 26 Jul 2020 12:17:56 -0700 (PDT) MIME-Version: 1.0 From: Carl Eugen Hoyos Date: Sun, 26 Jul 2020 21:17:45 +0200 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH]lavfi/hflip: Support Bayer pixel formats 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi! Attached patch fixes a part of ticket #8819. Please comment, Carl Eugen Subject: [PATCH] lavfi/hflip: Support Bayer pixel formats. Fixes part of ticket #8819. --- libavfilter/hflip.h | 1 + libavfilter/vf_hflip.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libavfilter/hflip.h b/libavfilter/hflip.h index 204090dbb4..32356cde34 100644 --- a/libavfilter/hflip.h +++ b/libavfilter/hflip.h @@ -27,6 +27,7 @@ typedef struct FlipContext { const AVClass *class; int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes + int bayer; ///< 1 .. not a Bayer input format, 2 .. Bayer input format int planewidth[4]; ///< width of each plane int planeheight[4]; ///< height of each plane diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c index b77afc77fc..77db218bda 100644 --- a/libavfilter/vf_hflip.c +++ b/libavfilter/vf_hflip.c @@ -138,6 +138,7 @@ static int config_props(AVFilterLink *inlink) s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, hsub); s->planeheight[0] = s->planeheight[3] = inlink->h; s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub); + s->bayer = !!(pix_desc->flags & AV_PIX_FMT_FLAG_BAYER) + 1; nb_planes = av_pix_fmt_count_planes(inlink->format); @@ -149,6 +150,7 @@ int ff_hflip_init(FlipContext *s, int step[4], int nb_planes) int i; for (i = 0; i < nb_planes; i++) { + step[i] *= s->bayer; switch (step[i]) { case 1: s->flip_line[i] = hflip_byte_c; break; case 2: s->flip_line[i] = hflip_short_c; break; @@ -180,7 +182,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) int i, plane, step; for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) { - const int width = s->planewidth[plane]; + const int width = s->planewidth[plane] / s->bayer; const int height = s->planeheight[plane]; const int start = (height * job ) / nb_jobs; const int end = (height * (job+1)) / nb_jobs;