[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    [PATCH v3 1/2] wined3d: Fix the odd line condition in gen_yv12_read().
From:       Anton Baskanov <baskanov () gmail ! com>
Date:       2021-08-31 16:26:24
Message-ID: 20210831162625.449856-1-baskanov () gmail ! com
[Download RAW message or body]

Signed-off-by: Anton Baskanov <baskanov@gmail.com>
---
The original condition is true for every other line, which is incorrect
since the chroma has only half the resolution. Fixes comb artifacts
around color transitions.

v2: Added a comment.
v3: Split condition simplification into a separate patch.
---
 dlls/wined3d/glsl_shader.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 5ae90148dc8..c760d519b30 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -12621,8 +12621,10 @@ static void gen_yv12_read(struct wined3d_string_buffer *buffer,
      * Don't forget to clamp the y values in into the range, otherwise we'll
      * get filtering bleeding. */
 
-    /* Read odd lines from the right side (add 0.5 to the x coordinate). */
-    shader_addline(buffer, "    if (fract(floor(texcoord.y * size.y) * 0.5 + 1.0 / 6.0) >= 0.5)\n");
+    /* Read odd lines from the right side (add 0.5 to the x coordinate). Keep
+     * in mind that each line of the chroma plane corresponds to 2 lines of the
+     * resulting image. */
+    shader_addline(buffer, "    if (fract(floor(texcoord.y * size.y) * 0.25 + 1.0 / 6.0) >= 0.5)\n");
     shader_addline(buffer, "        texcoord.x += 0.5;\n");
 
     /* Clamp, keep the half pixel origin in mind. */
-- 
2.25.1


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic