avfilter/vf_showinfo: Fix erroneous results for mean and stdev with pixel bits >8
authorLimin Wang <lance.lmwang@gmail.com>
Mon, 6 Jan 2020 19:54:17 +0000 (20:54 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 7 Jan 2020 01:49:44 +0000 (02:49 +0100)
commitd31a1266a789584d7de4a6c2f5d7f862003ad7ad
tree7aa0bc6740d539dc79e0d059680db1c86ff8d0b3
parent220846f74fc33fc037147e54535bcaef8caad28b
avfilter/vf_showinfo: Fix erroneous results for mean and stdev with pixel bits >8

Have tested with be and le pixel format on be and le system for >8bit.
System:
lmwang@ubuntu:~/ffmpeg.git.mips$ grep HAVE_BIGENDIAN config.h
ffmpeg.git git:(showinfo) ✗ grep HAVE_BIGENDIAN config.h

Test result:
1, yuv420p
./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p,showinfo
Master:
mean:[16 128 128] stdev:[0.0 0.0 0.0]
After applied the patch:
 mean:[16 128 128] stdev:[0.0 0.0 0.0]

2, yuv420p10le
./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p10le,showinfo
Master:
mean:[32 1 1] stdev:[32.0 1.0 1.0]
After applied the patch:
mean:[64 512 512] stdev:[0.0 0.0 0.0]

3, yuv420p10be
./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p10be,showinfo
Master:
mean:[32 1 1] stdev:[32.0 1.0 1.0]
After applied the patch:
mean:[64 512 512] stdev:[0.0 0.0 0.0]

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavfilter/vf_showinfo.c