From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 0E4BC47C2A for ; Fri, 12 Jan 2024 16:09:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 22DE468CC92; Fri, 12 Jan 2024 18:09:40 +0200 (EET) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 11DD168C552 for ; Fri, 12 Jan 2024 18:09:33 +0200 (EET) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-40e55c885d7so35207165e9.0 for ; Fri, 12 Jan 2024 08:09:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kynesim-co-uk.20230601.gappssmtp.com; s=20230601; t=1705075773; x=1705680573; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KBl7cPYvJB68V7k9F43sFrvgVLISNWvIOUNDepA0D9M=; b=2Lo2btqY/22aNN4Nx/t6SRQR417uG096oITPxu/A9uhQvRsqIZrH6cO/EWwxb0QuVX gDE/kxHk/8PsN+eZvLxZqDqdocgwyLYIkUH//U5W+58eca4qSCrMykveDrZE3dwFi/IB eX2hznz4iv7g3uwNWwgaSXpiHP7IAEURq3lhUb/8g0zeiv0NbPEZJDQH4LphsHlrMdDA CEtzqMiLmLnrvzFZndIhwaHYOuHnGUlMJyjZeJoZuE56MPEhcdA4O+xEzsvOlxz+vwG+ 5cEGFh8XpbjhaoOLWQhVlp+bp6S+WlCdH2bCOMZUY2PRR92JKdUsZ2s3UnxZVj0A+jVn HDgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705075773; x=1705680573; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KBl7cPYvJB68V7k9F43sFrvgVLISNWvIOUNDepA0D9M=; b=DzxA4zoPju+PGFhS57nBQw5jDhvaSf3SCXLvrb3JLYZvOslyUX+Y4zehTzlgRcghgu mjimS4BUs3JF0iys/DQw1jP96OBKy07661Mgo63sC17o0Xwmr0aOyhpDl/L6MBvvYI0n EIxurG8pCY5paCPxOqm3GJirytnPHD9uG0QbLgcnBL0toy72TjpJQxKuJirLudISsG/P h4Oe0alMe8sT27z0MMFcVsYheP0fBAcUwC1BKmgOSuZ6k2VSwFHSQjwztQPHXjMD7G/a t5nKIoVi8KoNqzc0weibhgKH7pHwC9kIZ7iiefla0pmj6lJ+WR1CVKGX5zNGIrkcDIPP BvCA== X-Gm-Message-State: AOJu0YwipljXQoGtQolbR0u4+qweDta4HJOfpk35mrt/qreRbJQ3HxL+ dJPxVuLWcxyKz/U1gt0FLTFy2IeMrSl6qRLlEwRoERHu7K8= X-Google-Smtp-Source: AGHT+IGVbNc9tkZ+fsaGJeNdvIuIDpSb8ZyE0dQ35+WDPq1BTCZFDw4AEG6aFr0AAzARtR7IziR64Q== X-Received: by 2002:a05:600c:d8:b0:40e:628f:96fb with SMTP id u24-20020a05600c00d800b0040e628f96fbmr880435wmm.168.1705075773171; Fri, 12 Jan 2024 08:09:33 -0800 (PST) Received: from sucnaath.outer.uphall.net (cpc1-cmbg20-2-0-cust759.5-4.cable.virginm.net. [86.21.218.248]) by smtp.gmail.com with ESMTPSA id c28-20020adfa31c000000b0033775980d26sm4254633wrb.2.2024.01.12.08.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 08:09:32 -0800 (PST) From: John Cox To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Jan 2024 16:09:20 +0000 Message-Id: <20240112160920.522129-1-jc@kynesim.co.uk> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/vf_bwdif: Add capability to deinterlace NV12 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: John Cox Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: As bwdif takes no account of horizontally adjacent pixels the same code can be used on planes that have multiple components as is used on single component planes. Update the filtering code to cope with multi-component planes and add NV12 to the list of supported formats. Signed-off-by: John Cox --- libavfilter/vf_bwdif.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 353cd0b61a..e07783ff70 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -115,19 +115,28 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, YADIFContext *yadif = &bwdif->yadif; ThreadData td = { .frame = dstpic, .parity = parity, .tff = tff }; int i; + int last_plane = -1; for (i = 0; i < yadif->csp->nb_components; i++) { int w = dstpic->width; int h = dstpic->height; + const AVComponentDescriptor * const comp = yadif->csp->comp + i; + + // If the last plane was the same as this plane assume we've dealt + // with all the pels already + if (last_plane == comp->plane) + continue; + last_plane = comp->plane; if (i == 1 || i == 2) { w = AV_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w); h = AV_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h); } - td.w = w; - td.h = h; - td.plane = i; + // comp step is in bytes but td.w is in pels + td.w = w * comp->step / ((comp->depth + 7) / 8); + td.h = h; + td.plane = comp->plane; ff_filter_execute(ctx, filter_slice, &td, NULL, FFMIN((h+3)/4, ff_filter_get_nb_threads(ctx))); @@ -162,6 +171,7 @@ static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, + AV_PIX_FMT_NV12, AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP16, -- 2.40.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".