]> granicus.if.org Git - handbrake/commitdiff
rendersub: fix small blending error
authorjstebbins <jstebbins.hb@gmail.com>
Sun, 11 Jan 2015 16:23:14 +0000 (16:23 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Sun, 11 Jan 2015 16:23:14 +0000 (16:23 +0000)
The error is really small, but visible over some backgrounds.
See https://forum.handbrake.fr/viewtopic.php?f=5&t=30942

git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/0.10.x@6729 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/rendersub.c

index 1ca7ac7bcb5ac35bebb0cf71b0f2ddbad40196af..6fbe18da64750aa50b9fe0098133e7786ae8bc8c 100644 (file)
@@ -136,7 +136,7 @@ static void blend( hb_buffer_t *dst, hb_buffer_t *src, int left, int top )
              */
             y_out[left + xx] =
                 ( (uint16_t)y_out[left + xx] * ( 255 - alpha ) +
-                     (uint16_t)y_in[xx] * alpha ) >> 8;
+                     (uint16_t)y_in[xx] * alpha ) / 255;
         }
     }
 
@@ -164,12 +164,12 @@ static void blend( hb_buffer_t *dst, hb_buffer_t *src, int left, int top )
             // Blend averge U and alpha
             u_out[(left >> wshift) + xx] =
                 ( (uint16_t)u_out[(left >> wshift) + xx] * ( 255 - alpha ) +
-                  (uint16_t)u_in[xx] * alpha ) >> 8;
+                  (uint16_t)u_in[xx] * alpha ) / 255;
 
             // Blend V and alpha
             v_out[(left >> wshift) + xx] =
                 ( (uint16_t)v_out[(left >> wshift) + xx] * ( 255 - alpha ) +
-                  (uint16_t)v_in[xx] * alpha ) >> 8;
+                  (uint16_t)v_in[xx] * alpha ) / 255;
         }
     }
 }