LCOV - code coverage report
Current view: top level - libavcodec/x86 - vp56_arith.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 9 9 100.0 %
Date: 2017-10-18 21:45:51 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /**
       2             :  * VP5 and VP6 compatible video decoder (arith decoder)
       3             :  *
       4             :  * Copyright (C) 2006  Aurelien Jacobs <aurel@gnuage.org>
       5             :  * Copyright (C) 2010  Eli Friedman
       6             :  *
       7             :  * This file is part of FFmpeg.
       8             :  *
       9             :  * FFmpeg is free software; you can redistribute it and/or
      10             :  * modify it under the terms of the GNU Lesser General Public
      11             :  * License as published by the Free Software Foundation; either
      12             :  * version 2.1 of the License, or (at your option) any later version.
      13             :  *
      14             :  * FFmpeg is distributed in the hope that it will be useful,
      15             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17             :  * Lesser General Public License for more details.
      18             :  *
      19             :  * You should have received a copy of the GNU Lesser General Public
      20             :  * License along with FFmpeg; if not, write to the Free Software
      21             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
      22             :  */
      23             : 
      24             : #ifndef AVCODEC_X86_VP56_ARITH_H
      25             : #define AVCODEC_X86_VP56_ARITH_H
      26             : 
      27             : #if HAVE_INLINE_ASM && HAVE_FAST_CMOV && HAVE_6REGS
      28             : #define vp56_rac_get_prob vp56_rac_get_prob
      29    28449751 : static av_always_inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob)
      30             : {
      31    28449751 :     unsigned int code_word = vp56_rac_renorm(c);
      32    28449751 :     unsigned int low = 1 + (((c->high - 1) * prob) >> 8);
      33    28449751 :     unsigned int low_shift = low << 16;
      34    28449751 :     int bit = 0;
      35    28449751 :     c->code_word = code_word;
      36             : 
      37    28449751 :     __asm__(
      38             :         "subl  %4, %1      \n\t"
      39             :         "subl  %3, %2      \n\t"
      40             :         "setae %b0         \n\t"
      41             :         "cmovb %4, %1      \n\t"
      42             :         "cmovb %5, %2      \n\t"
      43    28449751 :         : "+q"(bit), "+&r"(c->high), "+&r"(c->code_word)
      44             :         : "r"(low_shift), "r"(low), "r"(code_word)
      45             :     );
      46             : 
      47    28449751 :     return bit;
      48             : }
      49             : #endif
      50             : 
      51             : #endif /* AVCODEC_X86_VP56_ARITH_H */

Generated by: LCOV version 1.13