Hi Nathan,
Ah, I have same question in couple years ago. The root cause lies in the type of intermediate variable, the sign bit will affacf high part of combine varible. so if you change sum_t to sum2_t on variable A & B, you will get correct result. Regards, Min Chen At 2021-11-25 12:36:18, "nathan" <13022198...@163.com> wrote: hi Guys, At source/common/pixel.cpp: line 203 An function seems have an error: // in: a pseudo-simd number of the form x+(y<<16) // return: abs(x)+(abs(y)<<16) inlinesum2_tabs2(sum2_ta) { sum2_ts = ((a >> (BITS_PER_SUM - 1)) & (((sum2_t)1 << BITS_PER_SUM) + 1)) * ((sum_t)-1); return (a + s) ^ s; } see my test : int main() { sum_t A = -1; # 0xffff sum_t B = -2; # 0xfffe sum2_t C = (B << BITS_PER_SUM) + A; # 0xfffeffff sum2_t D = abs2(C); # 0x00010001 sum2_t E = (2 << BITS_PER_SUM) + 1; # 0x00020001 } At the function description, the D should be equal to E, but it not the same from my test. (please check the test is ok or not, in case I missed something....) the abs2() is used to calculate SATD, which effect the selection of motion evaluation, not effect the correctness of encoder function. (can someone tell me where can I commit this bug report to? Thanks!) BR-x265, Nathan
_______________________________________________ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel