almondyoung / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

C match SIMD exactly #447

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Currently C and SIMD dont exactly match for some functions/cpus.
Functions that do odd width use a combination of C and SIMD and can show a 
subtle artifact.   See this chromoting bug 
https://code.google.com/p/chromium/issues/detail?id=493914

For this use case, its important that C and SIMD match.
Neither needs to be accurate, and different platforms can be different.  But 
the C needs to exactly match the SIMD.

Reduce tolerance in unittests to zero.
Change C to mimic SIMD, even if performance is substantially worse for C.

Original issue reported on code.google.com by fbarch...@chromium.org on 3 Jun 2015 at 10:37

GoogleCodeExporter commented 8 years ago
The following unittests contain EXPECT_NEAR and are likely not exact:
color_test.cc
convert_test.cc
math_test.cc
planar_test.cc
scale_color_test.cc
version_test.cc

The following unittests contain a diff threshold and are likely not exact:
compare_test.cc
scale_argb_test.cc
scale_test.cc

The following unittests do not contain NEAR or diff and are likely exact:
basictypes_test.cc
cpu_test.cc
rotate_argb_test.cc
rotate_test.cc
video_common_test.cc

Original comment by fbarch...@google.com on 30 Jun 2015 at 7:38

GoogleCodeExporter commented 8 years ago
in planar_test attenuate, unattenuate and interpolate have differences

Original comment by fbarch...@google.com on 1 Jul 2015 at 8:25

GoogleCodeExporter commented 8 years ago
Lower priority because C code can be avoided now, using SIMD for any width.

Conversion unittests used to rely on C vs SIMD, but new tests compare 1 step vs 
2 step, so SIMD can be validated without C code.
Many functions would work without C code at all.

Original comment by fbarch...@chromium.org on 14 Nov 2015 at 2:59

GoogleCodeExporter commented 8 years ago
The following revision refers to this bug:
  https://chromium.googlesource.com/libyuv/libyuv.git/+/ae55e418517651548638b27be31d1b2abaed22bb

commit ae55e418517651548638b27be31d1b2abaed22bb
Author: Frank Barchard <fbarchard@google.com>
Date: Tue Dec 15 01:25:36 2015

use rounding in scaledown by 2

When scaling down by 2 the formula should round consistently.
(a+b+c+d+2)/4
The C version did but the SSE2 version was doing 2 averages.
avg(avg(a,b),avg(c,d))
This change uses a sum, then rounds.

R=dhrosa@google.com, harryjin@google.com
BUG=libyuv:447,libyuv:527

Review URL: https://codereview.chromium.org/1513183004 .

[modify] 
http://crrev.com/ae55e418517651548638b27be31d1b2abaed22bb/README.chromium
[modify] 
http://crrev.com/ae55e418517651548638b27be31d1b2abaed22bb/include/libyuv/scale_r
ow.h
[modify] 
http://crrev.com/ae55e418517651548638b27be31d1b2abaed22bb/include/libyuv/version
.h
[modify] 
http://crrev.com/ae55e418517651548638b27be31d1b2abaed22bb/source/planar_function
s.cc
[modify] 
http://crrev.com/ae55e418517651548638b27be31d1b2abaed22bb/source/scale.cc
[modify] 
http://crrev.com/ae55e418517651548638b27be31d1b2abaed22bb/source/scale_any.cc
[modify] 
http://crrev.com/ae55e418517651548638b27be31d1b2abaed22bb/source/scale_gcc.cc
[modify] 
http://crrev.com/ae55e418517651548638b27be31d1b2abaed22bb/source/scale_win.cc
[modify] 
http://crrev.com/ae55e418517651548638b27be31d1b2abaed22bb/unit_test/planar_test.
cc

Original comment by bugdroid1@chromium.org on 15 Dec 2015 at 1:26

GoogleCodeExporter commented 8 years ago
The following revision refers to this bug:
  https://chromium.googlesource.com/libyuv/libyuv.git/+/80ca4514ef6471a4e86dd333dcd271624c678233

commit 80ca4514ef6471a4e86dd333dcd271624c678233
Author: Frank Barchard <fbarchard@google.com>
Date: Wed Dec 16 05:25:18 2015

change scale down by 4 to use rounding.

TBR=harryjin@google.com
BUG=libyuv:447

Review URL: https://codereview.chromium.org/1525033005 .

[modify] 
http://crrev.com/80ca4514ef6471a4e86dd333dcd271624c678233/include/libyuv/scale_r
ow.h
[modify] http://crrev.com/80ca4514ef6471a4e86dd333dcd271624c678233/libyuv.gyp
[modify] 
http://crrev.com/80ca4514ef6471a4e86dd333dcd271624c678233/source/scale.cc
[modify] 
http://crrev.com/80ca4514ef6471a4e86dd333dcd271624c678233/source/scale_any.cc
[modify] 
http://crrev.com/80ca4514ef6471a4e86dd333dcd271624c678233/source/scale_gcc.cc
[modify] 
http://crrev.com/80ca4514ef6471a4e86dd333dcd271624c678233/source/scale_win.cc
[modify] 
http://crrev.com/80ca4514ef6471a4e86dd333dcd271624c678233/unit_test/scale_test.c
c

Original comment by bugdroid1@chromium.org on 16 Dec 2015 at 5:26