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 7AD4747C67 for ; Sun, 14 Jan 2024 15:14:18 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ADE0768CDE3; Sun, 14 Jan 2024 17:14:14 +0200 (EET) Received: from smtp2.us.opalstack.com (smtp2.us.opalstack.com [23.106.47.103]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7197F68CD4E for ; Sun, 14 Jan 2024 17:14:07 +0200 (EET) Received: from [10.88.111.38] (unknown [64.137.151.198]) by smtp2.us.opalstack.com (Postfix) with ESMTPSA id 1C72C1D0E0C for ; Sun, 14 Jan 2024 15:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeffreyknockel.com; s=dkim; t=1705245244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hZQZsFKWIEswtdIS87IgHVxNaKZmaqIJvR9uz76Yo7A=; b=U1h4fL9/Q8ADjXWPxZCVbeulnG8xPja/NyLdt378bvwGKuDCoQZH+Qg8P5x0DFtwkLlJU3 BdPC08Z1IQQY6/KiSkyZoNrHhgISoRsZ039bs3k0sx9dy7iZgh30yjRggSC6OzZM6Fvaz7 +YRAGkqYWi4Q2yXmALtIwuoneQbNTvY= Message-ID: Date: Sun, 14 Jan 2024 10:14:02 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20240108145336.380094-1-jeff@jeffreyknockel.com> From: Jeffrey Knockel In-Reply-To: X-Spam-Status: No, score=-2.12 Subject: Re: [FFmpeg-devel] [PATCH] avutil/pixfmt: fix AV_PIX_FMT_RGB8 description 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 1/14/24 6:32 AM, Stefano Sabatini wrote: > On date Monday 2024-01-08 09:53:37 -0500, Jeffrey Knockel wrote: >> Previously the description was partially mistaken, explaining the format >> as RGB 3:3:2, (msb)2R 3G 3B(lsb). While the RGB 3:3:2 part is correct, >> the latter part should be: (msb)3R 3G 2B(lsb). The corresponding bit >> masks are red: 0xE0, green: 0x1C, blue: 0x03. >> >> Signed-off-by: Jeffrey Knockel >> --- >> libavutil/pixfmt.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h >> index 58f9ad28bd..9c87571f49 100644 >> --- a/libavutil/pixfmt.h >> +++ b/libavutil/pixfmt.h >> @@ -83,7 +83,7 @@ enum AVPixelFormat { >> AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) >> AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits >> AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) > >> - AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) >> + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb) > > This is not consistent with pixdesc definition: > [AV_PIX_FMT_RGB8] = { > .name = "rgb8", > .nb_components = 3, > .log2_chroma_w = 0, > .log2_chroma_h = 0, > .comp = { > { 0, 1, 0, 6, 2 }, /* R */ > { 0, 1, 0, 3, 3 }, /* G */ > { 0, 1, 0, 0, 3 }, /* B */ > }, > .flags = AV_PIX_FMT_FLAG_RGB, > }, > > so either the documentation or the pixdesc description is wrong. > > Do you confirm "(msb)3R 3G 2B(lsb)" is the correct definition? Yes, I created three solid-colored RGBA raw samples filled with either #ff0000ff, #00ff00ff, or #0000ffff, and converted them using `ffmpeg ... -pix_fmt rgba ... -pix_fmt rgb8 ...` and inspected the output. I also tested with `ffmpeg ... -pix_fmt rgba ... -pix_fmt yuv420p ...` followed by `ffmpeg ... -pix_fmt yuv420p ... -pix_fmt rgb8 ...`. In these tests the outputs were consistent with "(msb)3R 3G 2B(lsb)". > In this case pixdesc should be fixed accordingly. Got it, will send an updated patch! Thanks, Jeff _______________________________________________ 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".