LCOV - code coverage report
Current view: top level - libavcodec - dirac_dwt.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 27 30 90.0 %
Date: 2017-12-16 13:57:32 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) 2004-2010 Michael Niedermayer <michaelni@gmx.at>
       3             :  * Copyright (C) 2008 David Conrad
       4             :  *
       5             :  * This file is part of FFmpeg.
       6             :  *
       7             :  * FFmpeg is free software; you can redistribute it and/or
       8             :  * modify it under the terms of the GNU Lesser General Public
       9             :  * License as published by the Free Software Foundation; either
      10             :  * version 2.1 of the License, or (at your option) any later version.
      11             :  *
      12             :  * FFmpeg is distributed in the hope that it will be useful,
      13             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15             :  * Lesser General Public License for more details.
      16             :  *
      17             :  * You should have received a copy of the GNU Lesser General Public
      18             :  * License along with FFmpeg; if not, write to the Free Software
      19             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
      20             :  */
      21             : 
      22             : #include "libavutil/attributes.h"
      23             : #include "libavutil/avassert.h"
      24             : #include "libavutil/common.h"
      25             : #include "dirac_dwt.h"
      26             : 
      27             : #define TEMPLATE_8bit
      28             : #include "dirac_dwt_template.c"
      29             : 
      30             : #define TEMPLATE_10bit
      31             : #include "dirac_dwt_template.c"
      32             : 
      33             : #define TEMPLATE_12bit
      34             : #include "dirac_dwt_template.c"
      35             : 
      36         672 : int ff_spatial_idwt_init(DWTContext *d, DWTPlane *p, enum dwt_type type,
      37             :                          int decomposition_count, int bit_depth)
      38             : {
      39         672 :     int ret = 0;
      40             : 
      41         672 :     d->buffer = p->buf;
      42         672 :     d->width  = p->width;
      43         672 :     d->height = p->height;
      44         672 :     d->stride = p->stride;
      45         672 :     d->temp   = p->tmp;
      46         672 :     d->decomposition_count = decomposition_count;
      47             : 
      48         672 :     if (bit_depth == 8)
      49         348 :         ret = ff_spatial_idwt_init_8bit(d, type);
      50         324 :     else if (bit_depth == 10)
      51         162 :         ret = ff_spatial_idwt_init_10bit(d, type);
      52         162 :     else if (bit_depth == 12)
      53         162 :         ret = ff_spatial_idwt_init_12bit(d, type);
      54             :     else
      55           0 :         av_log(NULL, AV_LOG_WARNING, "Unsupported bit depth = %i\n", bit_depth);
      56             : 
      57         672 :     if (ret) {
      58           0 :         av_log(NULL, AV_LOG_ERROR, "Unknown wavelet type %d\n", type);
      59           0 :         return AVERROR_INVALIDDATA;
      60             :     }
      61             : 
      62         672 :     if (ARCH_X86 && bit_depth == 8)
      63         348 :         ff_spatial_idwt_init_x86(d, type);
      64         672 :     return 0;
      65             : }
      66             : 
      67       11496 : void ff_spatial_idwt_slice2(DWTContext *d, int y)
      68             : {
      69       11496 :     int level, support = d->support;
      70             : 
      71       53760 :     for (level = d->decomposition_count-1; level >= 0; level--) {
      72       42264 :         int wl = d->width  >> level;
      73       42264 :         int hl = d->height >> level;
      74       42264 :         int stride_l = d->stride << level;
      75             : 
      76      234714 :         while (d->cs[level].y <= FFMIN((y>>level)+support, hl))
      77      150186 :             d->spatial_compose(d, level, wl, hl, stride_l);
      78             :     }
      79       11496 : }

Generated by: LCOV version 1.13