<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>These bunch of define are pretty ugly anyway. I prefer a pretty duplicated code rather than these tons of defines.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>Define should be avoided as much as possible.<br></span></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div class="y_msg_container"> <hr size="1"><br>On 15.04.2013 02:10, Nozomi Kodama wrote:<br>> Hello<br>> <br>> thanks for the review.<br>> I don't think that calling defines is the way to go. Indeed, I tested my patch and yours. Yours is about 12% slower than mine in my
 computer.<br>> And now, we try to take care of efficiency of this dll. So, it is not the time  to increase latency.<br>> <br>You are right. I'm not really sure why the code should be slower though. The #defines shouldn't have an impact on the performance, but it might be because it is translated to:<br><br>ta = 0.28209479f * a[0] + -0.12615662f * a[6] + -0.21850968f * a[8];<br>tb = 0.28209479f * b[0] + -0.12615662f * b[6] + -0.21850968f * b[8];<br>out[1] = 0.0f + ta * b[1] + tb * a[1];<br>t = a[1] * b[1];<br>out[0] = out[0] + 0.28209479f * t;<br>out[6] = 0.0f + -0.12615662f * t;<br>out[8] = 0.0f + -0.21850968f * t;<br><br>instead of:<br>ta = 0.28209479f * a[0] - 0.12615662f * a[6] - 0.21850968f * a[8];<br>tb = 0.28209479f * b[0] - 0.12615662f * b[6] - 0.21850968f * b[8];<br>out[1] = ta * b[1] + tb * a[1];<br>t = a[1] * b[1];<br>out[0] += 0.28209479f * t;<br>out[6] = -0.12615662f * t;<br>out[8] = -0.21850968f * t;<br><br>May be due to "out[8]
 = -0.21850968f * t;" vs "out[8] = 0.0f + -0.21850968f * t;":<br>1. the extra 0.0f - Shouldn't the 0.0f get optimized away? Imho the macro could be fixed (e.g. use an if / separate macro / don't use a macro for this cases).<br>2. "+ -0.21850968f * t;" should be as fast as "-0.21850968f * t" isn't it?<br><br>Does anyone else have an objection about this? I just feel that the code size and the always reused constants could be written a little bit nicer. I'm not sure if the macro usage is really better, it was just a quick idea to avoid that much code duplication. Also changes like the suggested below are really error prone, because they change a lot of code mostly using copy and paste. Though I vote for the same style and precision usage in all cases.<br><br>Hope this helps a bit<br>Rico<br><br>> <br>> I used 10 digits since there are a lot of computation, I want to avoid as much as possible big rounding errors. If we want to uniformize, then we
 should uniformize d3dxshmultiply 2,3,4 with 10 digits.<br>> But that is for an another patch.<br>> <br>> Nozomi.<br>> <br>> <br><br><br><br></div> </div> </div>  </div></body></html>