[FFmpeg-cvslog] avcodec/tests/snowenc: return a failure if DWT/IDWT mismatches

Michael Niedermayer git at videolan.org
Tue Mar 28 00:15:45 EEST 2023


ffmpeg | branch: release/5.0 | Michael Niedermayer <michael at niedermayer.cc> | Fri Mar 24 00:31:40 2023 +0100| [1fca7ff2be7a303f208b6cc10828876d013cb62e] | committer: Michael Niedermayer

avcodec/tests/snowenc: return a failure if DWT/IDWT mismatches

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 771c266c0be29e6a1001fbd6795dd343147da1f2)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1fca7ff2be7a303f208b6cc10828876d013cb62e
---

 libavcodec/tests/snowenc.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavcodec/tests/snowenc.c b/libavcodec/tests/snowenc.c
index 28b925d7d4..693234b7ca 100644
--- a/libavcodec/tests/snowenc.c
+++ b/libavcodec/tests/snowenc.c
@@ -37,6 +37,7 @@ int main(void){
     AVLFG prng;
     s.spatial_decomposition_count=6;
     s.spatial_decomposition_type=1;
+    int ret = 0;
 
     s.temp_dwt_buffer  = av_calloc(width, sizeof(*s.temp_dwt_buffer));
     s.temp_idwt_buffer = av_calloc(width, sizeof(*s.temp_idwt_buffer));
@@ -58,7 +59,10 @@ int main(void){
     ff_spatial_idwt(obuffer, s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
 
     for(i=0; i<width*height; i++)
-        if(buffer[1][i]!= obuffer[i]) printf("fsck: %4dx%4dx %12d %7d\n",i%width, i/width, buffer[1][i], obuffer[i]);
+        if(buffer[1][i]!= obuffer[i]) {
+            printf("fsck: %4dx%4dx %12d %7d\n",i%width, i/width, buffer[1][i], obuffer[i]);
+            ret = 1;
+        }
 
     printf("testing 9/7 DWT\n");
     s.spatial_decomposition_type=0;
@@ -71,7 +75,10 @@ int main(void){
     ff_spatial_idwt(obuffer, s.temp_idwt_buffer, width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
 
     for(i=0; i<width*height; i++)
-        if(FFABS(buffer[1][i] - obuffer[i])>20) printf("fsck: %4dx%4d %12d %7d\n",i%width, i/width, buffer[1][i], obuffer[i]);
+        if(FFABS(buffer[1][i] - obuffer[i])>20) {
+            printf("fsck: %4dx%4d %12d %7d\n",i%width, i/width, buffer[1][i], obuffer[i]);
+            ret = 1;
+        }
 
     {
     int level, orientation, x, y;
@@ -148,5 +155,5 @@ int main(void){
         }
 
     }
-    return 0;
+    return ret;
 }



More information about the ffmpeg-cvslog mailing list