]> granicus.if.org Git - handbrake/commitdiff
rendersub: fix small blending error
authorjstebbins <jstebbins.hb@gmail.com>
Sat, 10 Jan 2015 22:03:15 +0000 (22:03 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Sat, 10 Jan 2015 22:03:15 +0000 (22:03 +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/trunk@6726 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/rendersub.c

index 6bf56f451191f38704af2efce18e2fcbe5e45b53..ac05f635a590fdb230cdabf6cf743c0e9840d1f1 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;
         }
     }
 }