From 29923cb8e1219398fd21ccfab11214a4df73b521 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Tue, 3 Apr 2007 20:41:33 +0000 Subject: [PATCH] Optimized the YV12->RGB32 conversion in AegiVideoFrame Originally committed to SVN as r987. --- aegisub/video_frame.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/aegisub/video_frame.cpp b/aegisub/video_frame.cpp index d07b02a19..d9cc248e0 100644 --- a/aegisub/video_frame.cpp +++ b/aegisub/video_frame.cpp @@ -288,28 +288,20 @@ void AegiVideoFrame::ConvertFrom(const AegiVideoFrame &source) { const int src_delta2 = source.pitch[1]-w/2; const int src_delta3 = source.pitch[2]-w/2; const int dst_delta = pitch[0]-w*4; - int r,g,b,y,u,v,c,d,e; + register int y,u,v; // Loop for (unsigned int py=0;py> 8,255); - g = MID(0,( 298 * c - 100 * d - 208 * e + 128) >> 8,255); - b = MID(0,( 298 * c + 516 * d + 128) >> 8,255); + y = (*src_y++ - 16) * 298; // Assign - *dst++ = b; - *dst++ = g; - *dst++ = r; + *dst++ = MID(0,(y + 516 * u + 128) >> 8,255); // Blue + *dst++ = MID(0,(y - 100 * u - 208 * v + 128) >> 8,255); // Green + *dst++ = MID(0,(y + 409 * v + 128) >> 8,255); // Red *dst++ = 0; } }