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 8F40E436B1 for ; Tue, 21 Jun 2022 19:46:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EB35468B63D; Tue, 21 Jun 2022 22:46:26 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8A4DF68B5F2 for ; Tue, 21 Jun 2022 22:46:20 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id EE4F74A702; Tue, 21 Jun 2022 21:46:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1655840780; bh=jGIn04clmrW7RvVvSqwIC/ZPgVU51WvXA//JE7MynQU=; h=From:To:Cc:Subject:Date:From; b=jPXJoDlhCtjToC5PWFukVaYm4lvrLIFQkc+HRFBCebSOWEuw71D7+WpF0XoWDY8HG fuiYUqJci/rPUr2t3l+WanVQ7TMkOud9l0laygJ4S3ob0YcZI23SctA/DhK0yTshhP O/36Y/uY4Cob1g/erhPzaO+J757LDuEO69mN2ap8= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 Jun 2022 21:46:17 +0200 Message-Id: <20220621194617.76561-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] fftools/ffplay: fix YUV conversion mode 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: Niklas Haas 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: From: Niklas Haas GL and Metal cache the state at time of texture creation. GLES2 and Direct3D 11 use the state at time of the render copy call. So the only way we can get the correct behavior consistently is by making sure the state is set for both the upload *and* the draw call. This probably isn't our bug to fix (upstream should make itself behave consistently and also document its functions), but as it stands, `ffplay` is misrendering BT.709 as BT.601 on my stock Linux system, and that leaves a bad taste in my mouth. Signed-off-by: Niklas Haas --- fftools/ffplay.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 040afa0189..9242047f5c 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1011,15 +1011,17 @@ static void video_image_display(VideoState *is) } calculate_display_rect(&rect, is->xleft, is->ytop, is->width, is->height, vp->width, vp->height, vp->sar); + set_sdl_yuv_conversion_mode(vp->frame); if (!vp->uploaded) { - if (upload_texture(&is->vid_texture, vp->frame, &is->img_convert_ctx) < 0) + if (upload_texture(&is->vid_texture, vp->frame, &is->img_convert_ctx) < 0) { + set_sdl_yuv_conversion_mode(NULL); return; + } vp->uploaded = 1; vp->flip_v = vp->frame->linesize[0] < 0; } - set_sdl_yuv_conversion_mode(vp->frame); SDL_RenderCopyEx(renderer, is->vid_texture, NULL, &rect, 0, NULL, vp->flip_v ? SDL_FLIP_VERTICAL : 0); set_sdl_yuv_conversion_mode(NULL); if (sp) { -- 2.36.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".