LCOV - code coverage report
Current view: top level - tests/checkasm - huffyuvdsp.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 29 0.0 %
Date: 2017-12-18 06:23:41 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016 Alexandra Hájková
       3             :  *
       4             :  * This file is part of FFmpeg.
       5             :  *
       6             :  * FFmpeg is free software; you can redistribute it and/or modify
       7             :  * it under the terms of the GNU General Public License as published by
       8             :  * the Free Software Foundation; either version 2 of the License, or
       9             :  * (at your option) any later version.
      10             :  *
      11             :  * FFmpeg is distributed in the hope that it will be useful,
      12             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             :  * GNU General Public License for more details.
      15             :  *
      16             :  * You should have received a copy of the GNU General Public License along
      17             :  * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
      18             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      19             :  */
      20             : 
      21             : #include <string.h>
      22             : 
      23             : #include "libavutil/common.h"
      24             : #include "libavutil/intreadwrite.h"
      25             : #include "libavutil/mem.h"
      26             : 
      27             : #include "libavcodec/huffyuvdsp.h"
      28             : 
      29             : #include "checkasm.h"
      30             : 
      31             : #define randomize_buffers(buf, size)     \
      32             :     do {                                 \
      33             :         int j;                           \
      34             :         for (j = 0; j < size; j++)       \
      35             :             buf[j] = rnd() & 0xFFFF;       \
      36             :     } while (0)
      37             : 
      38           0 : static void check_add_int16(HuffYUVDSPContext c, unsigned mask, int width, const char * name)
      39             : {
      40           0 :     uint16_t *src0 = av_mallocz(width * sizeof(uint16_t));
      41           0 :     uint16_t *src1 = av_mallocz(width * sizeof(uint16_t));
      42           0 :     uint16_t *dst0 = av_mallocz(width * sizeof(uint16_t));
      43           0 :     uint16_t *dst1 = av_mallocz(width * sizeof(uint16_t));
      44             : 
      45           0 :     declare_func_emms(AV_CPU_FLAG_MMX, void, uint16_t *dst, uint16_t *src, unsigned mask, int w);
      46             : 
      47           0 :     if (!src0 || !src1 || !dst0 || !dst1)
      48           0 :         fail();
      49             : 
      50           0 :     randomize_buffers(src0, width);
      51           0 :     memcpy(src1, src0, width * sizeof(uint16_t));
      52             : 
      53           0 :     if (check_func(c.add_int16, "%s", name)) {
      54           0 :         call_ref(dst0, src0, mask, width);
      55           0 :         call_new(dst1, src1, mask, width);
      56           0 :         if (memcmp(dst0, dst1, width * sizeof(uint16_t)))
      57           0 :             fail();
      58           0 :         bench_new(dst1, src1, mask, width);
      59             :     }
      60             : 
      61           0 :     av_free(src0);
      62           0 :     av_free(src1);
      63           0 :     av_free(dst0);
      64           0 :     av_free(dst1);
      65           0 : }
      66             : 
      67           0 : void checkasm_check_huffyuvdsp(void)
      68             : {
      69             :     HuffYUVDSPContext c;
      70           0 :     int width = 16 * av_clip(rnd(), 16, 128);
      71             : 
      72           0 :     ff_huffyuvdsp_init(&c, AV_PIX_FMT_YUV422P);
      73             : 
      74             :     /*! test width not multiple of mmsize */
      75           0 :     check_add_int16(c, 65535, width, "add_int16_rnd_width");
      76           0 :     report("add_int16_rnd_width");
      77             : 
      78             :     /*! test always with the same size (for perf test) */
      79           0 :     check_add_int16(c, 65535, 16*128, "add_int16_128");
      80           0 :     report("add_int16_128");
      81           0 : }

Generated by: LCOV version 1.13