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 C96DB4654D for ; Sun, 20 Aug 2023 18:28:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0B8E468C0CB; Sun, 20 Aug 2023 21:28:49 +0300 (EEST) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1A03268BC82 for ; Sun, 20 Aug 2023 21:28:42 +0300 (EEST) Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-31781e15a0cso2345654f8f.3 for ; Sun, 20 Aug 2023 11:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kynesim-co-uk.20221208.gappssmtp.com; s=20221208; t=1692556121; x=1693160921; h=content-transfer-encoding:mime-version:user-agent:in-reply-to :references:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=TMLTREPXSJhM3xr1YYOh+/k5U5plwI21hn22/G+XmLk=; b=c+17355rAEiKFOsFMFZir0Hq4z3ufRJCbHMOXpH3BeF4K501gpOBkQYwGtROMsflNF 2xD9gIPatdr0EiDCl06rJgPg5+vRIjpu7Z+O/m/xCjGLRg5RL2SXPC9AwkgcDEasaKxv j+sC0P6drLp0bza2Su1Hn/kJLdPlEOm5n0a7oJE0PyOVhiGnSkr0FL8k1CtGgOF9ZtZU b7Z6c3gevRT8DDYPzY1TYVUd5DZdf+vXwvP/UJNR8boBY/sbYMxt9ukqCPHAy+cp14CQ GY5jQSaqTwIi+dupDncziwEbUQfqug/f22NDnLgKuxDdyg+0Q+NHdmbOMgdXkIVfVe5Z gn6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692556121; x=1693160921; h=content-transfer-encoding:mime-version:user-agent:in-reply-to :references:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=TMLTREPXSJhM3xr1YYOh+/k5U5plwI21hn22/G+XmLk=; b=PhWWVDBwlKjL438ATjheBoPjxcO6tADz75x2BkdmuHByggx2hVZY0jxPUjyAFywRT8 DnKbPdqetQGJDg8Av9BJ0UDbb6GNruhEGWlLUhPMrrKHmkBVCjpLjEvn8LbAAYenhoZb T9ysGArHXFdGhPY/04NmvtUfScHE0KfPa26r5cyYiNluNMGd2Uw3QQXhwnX854kZQMTb zpIs51lnyVjCILEvbVuvoLvEfAulP3pFGB4hS0vMFm/zmj8/2njnIclIQebmRTJSveQK zV2uJCnHNL9Utz/osO8C8cBmvhq9t4AfHJWz1GIjuIZxD8A7gyTEfJBDRHmoWKgFizar W9YA== X-Gm-Message-State: AOJu0Yz9ufJea1ZTbd3gRajevUSP1nYni3oIUgsW/A7jBsBD367F2IYA 4VUQwbFjixkWBxV2YPSiMyKWW2ifY7gq2b9WQPI= X-Google-Smtp-Source: AGHT+IGfey+wj8Q372PzBTWvm5jh9dbBhRa7YiPzrX2mzhCeFRnG2rEo1lPn3deEFO5asdKaB9ZAYQ== X-Received: by 2002:adf:ffc9:0:b0:319:52da:8f0b with SMTP id x9-20020adfffc9000000b0031952da8f0bmr3434856wrs.17.1692556121248; Sun, 20 Aug 2023 11:28:41 -0700 (PDT) Received: from CTHALPA.outer.uphall.net (cpc1-cmbg20-2-0-cust759.5-4.cable.virginm.net. [86.21.218.248]) by smtp.gmail.com with ESMTPSA id x8-20020a5d4448000000b0031432f1528csm9918984wrr.45.2023.08.20.11.28.40 for (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Sun, 20 Aug 2023 11:28:40 -0700 (PDT) From: John Cox To: FFmpeg development discussions and patches Cc: FFmpeg development discussions and patches Date: Sun, 20 Aug 2023 19:28:40 +0100 Message-ID: <5pl4eilterjun2l0up51r8jg1pvdluq7b2@4ax.com> References: <20230820151022.2204421-1-jc@kynesim.co.uk> <20230820151022.2204421-4-jc@kynesim.co.uk> <20230820171614.GC7802@pb2> <20230820174511.GD7802@pb2> In-Reply-To: <20230820174511.GD7802@pb2> User-Agent: ForteAgent/8.00.32.1272 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v1 3/6] swscale: Add explicit rgb24->yv12 conversion 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 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: On Sun, 20 Aug 2023 19:45:11 +0200, you wrote: >On Sun, Aug 20, 2023 at 07:16:14PM +0200, Michael Niedermayer wrote: >> On Sun, Aug 20, 2023 at 03:10:19PM +0000, John Cox wrote: >> > Add a rgb24->yuv420p conversion. Uses the same code as the existing >> > bgr24->yuv converter but permutes the conversion array to swap R & B >> > coefficients. >> > >> > Signed-off-by: John Cox >> > --- >> > libswscale/rgb2rgb.c | 5 +++++ >> > libswscale/rgb2rgb.h | 7 +++++++ >> > libswscale/rgb2rgb_template.c | 38 ++++++++++++++++++++++++++++++----- >> > libswscale/swscale_unscaled.c | 24 +++++++++++++++++++++- >> > 4 files changed, 68 insertions(+), 6 deletions(-) >> > >> > diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c >> > index 8707917800..de90e5193f 100644 >> > --- a/libswscale/rgb2rgb.c >> > +++ b/libswscale/rgb2rgb.c >> > @@ -83,6 +83,11 @@ void (*ff_bgr24toyv12)(const uint8_t *src, uint8_t *ydst, >> > int width, int height, >> > int lumStride, int chromStride, int srcStride, >> > int32_t *rgb2yuv); >> > +void (*ff_rgb24toyv12)(const uint8_t *src, uint8_t *ydst, >> > + uint8_t *udst, uint8_t *vdst, >> > + int width, int height, >> > + int lumStride, int chromStride, int srcStride, >> > + int32_t *rgb2yuv); >> > void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, >> > int srcStride, int dstStride); >> > void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst, >> > diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h >> > index 305b830920..f7a76a92ba 100644 >> > --- a/libswscale/rgb2rgb.h >> > +++ b/libswscale/rgb2rgb.h >> > @@ -79,6 +79,9 @@ void rgb12to15(const uint8_t *src, uint8_t *dst, int src_size); >> > void ff_bgr24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, >> > uint8_t *vdst, int width, int height, int lumStride, >> > int chromStride, int srcStride, int32_t *rgb2yuv); >> > +void ff_rgb24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, >> > + uint8_t *vdst, int width, int height, int lumStride, >> > + int chromStride, int srcStride, int32_t *rgb2yuv); >> > >> > /** >> > * Height should be a multiple of 2 and width should be a multiple of 16. >> > @@ -128,6 +131,10 @@ extern void (*ff_bgr24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, >> > int width, int height, >> > int lumStride, int chromStride, int srcStride, >> > int32_t *rgb2yuv); >> > +extern void (*ff_rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, >> > + int width, int height, >> > + int lumStride, int chromStride, int srcStride, >> > + int32_t *rgb2yuv); >> > extern void (*planar2x)(const uint8_t *src, uint8_t *dst, int width, int height, >> > int srcStride, int dstStride); >> > >> > diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c >> > index 8ef4a2cf5d..e57bfa6545 100644 >> > --- a/libswscale/rgb2rgb_template.c >> > +++ b/libswscale/rgb2rgb_template.c >> >> >> > @@ -646,13 +646,14 @@ static inline void uyvytoyv12_c(const uint8_t *src, uint8_t *ydst, >> > * others are ignored in the C version. >> > * FIXME: Write HQ version. >> > */ >> > -void ff_bgr24toyv12_c(const uint8_t *src, uint8_t *ydst, uint8_t *udst, >> > +static void rgb24toyv12_x(const uint8_t *src, uint8_t *ydst, uint8_t *udst, >> >> this probably should be inline >> >> also i see now "FIXME: Write HQ version." above here. Do you really want to >> add a low quality rgb24toyv12 ? >> (it is vissible on the diagonal border (cyan / red )) in >> ./ffmpeg -f lavfi -i testsrc=size=5632x3168 -pix_fmt yuv420p -vframes 1 -qscale 1 -strict -1 new.jpg >> >> also on smaller sizes but for some reason its clearer on the big one zoomed in 400% with gimp >> (the gimp test was done with the whole patchset not after this patch) > >Also the reason why its LQ and looks like it does is because >1. half the RGB samples are ignored in computing the chroma samples I thought it was a bit light but it is what the existing code did >2. the chroma sample locations are ignored, the locations for yuv420 are reaonable standard As I recall MPEG-1 has chroma at (0.5, 0.5), MPEG-II defaults to (0.5, 0), H.265 defaults to (0,0). Printing out dst_h_chr_pos, dst_v_chr_pos in the setup of your example yields -513, 128 which I'm guessing means (unset, 0.5) - am I looking at the correct vars? >this needs some simple filter to get from a few RGB samples to the RGB sample co-located >with ths UV sample before RGB->UV I can get to simple bilinear without adding so much complexity that I lose the speed I need - would that be OK? Ta >thx > >[...] _______________________________________________ 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".