LCOV - code coverage report
Current view: top level - libavcodec/x86 - mpegvideoenc_template.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 215 0.0 %
Date: 2017-10-18 21:45:51 Functions: 0 4 0.0 %

          Line data    Source code
       1             : /*
       2             :  * MPEG video MMX templates
       3             :  *
       4             :  * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at>
       5             :  *
       6             :  * This file is part of FFmpeg.
       7             :  *
       8             :  * FFmpeg is free software; you can redistribute it and/or
       9             :  * modify it under the terms of the GNU Lesser General Public
      10             :  * License as published by the Free Software Foundation; either
      11             :  * version 2.1 of the License, or (at your option) any later version.
      12             :  *
      13             :  * FFmpeg is distributed in the hope that it will be useful,
      14             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16             :  * Lesser General Public License for more details.
      17             :  *
      18             :  * You should have received a copy of the GNU Lesser General Public
      19             :  * License along with FFmpeg; if not, write to the Free Software
      20             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
      21             :  */
      22             : 
      23             : #include <stdint.h>
      24             : 
      25             : #include "libavutil/internal.h"
      26             : #include "libavutil/x86/asm.h"
      27             : #include "libavcodec/mpegutils.h"
      28             : #include "libavcodec/mpegvideo.h"
      29             : #include "fdct.h"
      30             : 
      31             : #undef MMREG_WIDTH
      32             : #undef MM
      33             : #undef MOVQ
      34             : #undef SPREADW
      35             : #undef PMAXW
      36             : #undef PMAX
      37             : #undef SAVE_SIGN
      38             : #undef RESTORE_SIGN
      39             : 
      40             : #if COMPILE_TEMPLATE_SSE2
      41             : #define MMREG_WIDTH "16"
      42             : #define MM "%%xmm"
      43             : #define MOVQ "movdqa"
      44             : #define SPREADW(a) \
      45             :             "pshuflw $0, "a", "a"       \n\t"\
      46             :             "punpcklwd "a", "a"         \n\t"
      47             : #define PMAXW(a,b) "pmaxsw "a", "b"     \n\t"
      48             : #define PMAX(a,b) \
      49             :             "movhlps "a", "b"           \n\t"\
      50             :             PMAXW(b, a)\
      51             :             "pshuflw $0x0E, "a", "b"    \n\t"\
      52             :             PMAXW(b, a)\
      53             :             "pshuflw $0x01, "a", "b"    \n\t"\
      54             :             PMAXW(b, a)
      55             : #else
      56             : #define MMREG_WIDTH "8"
      57             : #define MM "%%mm"
      58             : #define MOVQ "movq"
      59             : #if COMPILE_TEMPLATE_MMXEXT
      60             : #define SPREADW(a) "pshufw $0, "a", "a" \n\t"
      61             : #define PMAXW(a,b) "pmaxsw "a", "b"     \n\t"
      62             : #define PMAX(a,b) \
      63             :             "pshufw $0x0E, "a", "b"     \n\t"\
      64             :             PMAXW(b, a)\
      65             :             "pshufw $0x01, "a", "b"     \n\t"\
      66             :             PMAXW(b, a)
      67             : #else
      68             : #define SPREADW(a) \
      69             :             "punpcklwd "a", "a"         \n\t"\
      70             :             "punpcklwd "a", "a"         \n\t"
      71             : #define PMAXW(a,b) \
      72             :             "psubusw "a", "b"           \n\t"\
      73             :             "paddw "a", "b"             \n\t"
      74             : #define PMAX(a,b)  \
      75             :             "movq "a", "b"              \n\t"\
      76             :             "psrlq $32, "a"             \n\t"\
      77             :             PMAXW(b, a)\
      78             :             "movq "a", "b"              \n\t"\
      79             :             "psrlq $16, "a"             \n\t"\
      80             :             PMAXW(b, a)
      81             : 
      82             : #endif
      83             : #endif
      84             : 
      85             : #if COMPILE_TEMPLATE_SSSE3
      86             : #define SAVE_SIGN(a,b) \
      87             :             "movdqa "b", "a"            \n\t"\
      88             :             "pabsw  "b", "b"            \n\t"
      89             : #define RESTORE_SIGN(a,b) \
      90             :             "psignw "a", "b"            \n\t"
      91             : #else
      92             : #define SAVE_SIGN(a,b) \
      93             :             "pxor "a", "a"              \n\t"\
      94             :             "pcmpgtw "b", "a"           \n\t" /* block[i] <= 0 ? 0xFF : 0x00 */\
      95             :             "pxor "a", "b"              \n\t"\
      96             :             "psubw "a", "b"             \n\t" /* ABS(block[i]) */
      97             : #define RESTORE_SIGN(a,b) \
      98             :             "pxor "a", "b"              \n\t"\
      99             :             "psubw "a", "b"             \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
     100             : #endif
     101             : 
     102           0 : static int RENAME(dct_quantize)(MpegEncContext *s,
     103             :                             int16_t *block, int n,
     104             :                             int qscale, int *overflow)
     105             : {
     106             :     x86_reg last_non_zero_p1;
     107           0 :     int level=0, q; //=0 is because gcc says uninitialized ...
     108             :     const uint16_t *qmat, *bias;
     109           0 :     LOCAL_ALIGNED_16(int16_t, temp_block, [64]);
     110             : 
     111             :     av_assert2((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly?
     112             : 
     113             :     //s->fdct (block);
     114           0 :     RENAME_FDCT(ff_fdct)(block); // cannot be anything else ...
     115             : 
     116           0 :     if(s->dct_error_sum)
     117           0 :         s->denoise_dct(s, block);
     118             : 
     119           0 :     if (s->mb_intra) {
     120             :         int dummy;
     121           0 :         if (n < 4){
     122           0 :             q = s->y_dc_scale;
     123           0 :             bias = s->q_intra_matrix16[qscale][1];
     124           0 :             qmat = s->q_intra_matrix16[qscale][0];
     125             :         }else{
     126           0 :             q = s->c_dc_scale;
     127           0 :             bias = s->q_chroma_intra_matrix16[qscale][1];
     128           0 :             qmat = s->q_chroma_intra_matrix16[qscale][0];
     129             :         }
     130             :         /* note: block[0] is assumed to be positive */
     131           0 :         if (!s->h263_aic) {
     132           0 :         __asm__ volatile (
     133             :                 "mul %%ecx                \n\t"
     134             :                 : "=d" (level), "=a"(dummy)
     135           0 :                 : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1])
     136             :         );
     137             :         } else
     138             :             /* For AIC we skip quant/dequant of INTRADC */
     139           0 :             level = (block[0] + 4)>>3;
     140             : 
     141           0 :         block[0]=0; //avoid fake overflow
     142             : //        temp_block[0] = (block[0] + (q >> 1)) / q;
     143           0 :         last_non_zero_p1 = 1;
     144             :     } else {
     145           0 :         last_non_zero_p1 = 0;
     146           0 :         bias = s->q_inter_matrix16[qscale][1];
     147           0 :         qmat = s->q_inter_matrix16[qscale][0];
     148             :     }
     149             : 
     150           0 :     if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){
     151             : 
     152           0 :         __asm__ volatile(
     153             :             "movd %%"FF_REG_a", "MM"3           \n\t" // last_non_zero_p1
     154             :             SPREADW(MM"3")
     155             :             "pxor "MM"7, "MM"7                  \n\t" // 0
     156             :             "pxor "MM"4, "MM"4                  \n\t" // 0
     157             :             MOVQ" (%2), "MM"5                   \n\t" // qmat[0]
     158             :             "pxor "MM"6, "MM"6                  \n\t"
     159             :             "psubw (%3), "MM"6                  \n\t" // -bias[0]
     160             :             "mov $-128, %%"FF_REG_a"            \n\t"
     161             :             ".p2align 4                         \n\t"
     162             :             "1:                                 \n\t"
     163             :             MOVQ" (%1, %%"FF_REG_a"), "MM"0     \n\t" // block[i]
     164             :             SAVE_SIGN(MM"1", MM"0")                   // ABS(block[i])
     165             :             "psubusw "MM"6, "MM"0               \n\t" // ABS(block[i]) + bias[0]
     166             :             "pmulhw "MM"5, "MM"0                \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16
     167             :             "por "MM"0, "MM"4                   \n\t"
     168             :             RESTORE_SIGN(MM"1", MM"0")                // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
     169             :             MOVQ" "MM"0, (%5, %%"FF_REG_a")     \n\t"
     170             :             "pcmpeqw "MM"7, "MM"0               \n\t" // out==0 ? 0xFF : 0x00
     171             :             MOVQ" (%4, %%"FF_REG_a"), "MM"1     \n\t"
     172             :             MOVQ" "MM"7, (%1, %%"FF_REG_a")     \n\t" // 0
     173             :             "pandn "MM"1, "MM"0                 \n\t"
     174             :             PMAXW(MM"0", MM"3")
     175             :             "add $"MMREG_WIDTH", %%"FF_REG_a"   \n\t"
     176             :             " js 1b                             \n\t"
     177             :             PMAX(MM"3", MM"0")
     178             :             "movd "MM"3, %%"FF_REG_a"           \n\t"
     179             :             "movzbl %%al, %%eax                 \n\t" // last_non_zero_p1
     180             :             : "+a" (last_non_zero_p1)
     181           0 :             : "r" (block+64), "r" (qmat), "r" (bias),
     182           0 :               "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64)
     183             :               XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
     184             :                                 "%xmm4", "%xmm5", "%xmm6", "%xmm7")
     185             :         );
     186             :     }else{ // FMT_H263
     187           0 :         __asm__ volatile(
     188             :             "movd %%"FF_REG_a", "MM"3           \n\t" // last_non_zero_p1
     189             :             SPREADW(MM"3")
     190             :             "pxor "MM"7, "MM"7                  \n\t" // 0
     191             :             "pxor "MM"4, "MM"4                  \n\t" // 0
     192             :             "mov $-128, %%"FF_REG_a"            \n\t"
     193             :             ".p2align 4                         \n\t"
     194             :             "1:                                 \n\t"
     195             :             MOVQ" (%1, %%"FF_REG_a"), "MM"0     \n\t" // block[i]
     196             :             SAVE_SIGN(MM"1", MM"0")                   // ABS(block[i])
     197             :             MOVQ" (%3, %%"FF_REG_a"), "MM"6     \n\t" // bias[0]
     198             :             "paddusw "MM"6, "MM"0               \n\t" // ABS(block[i]) + bias[0]
     199             :             MOVQ" (%2, %%"FF_REG_a"), "MM"5     \n\t" // qmat[i]
     200             :             "pmulhw "MM"5, "MM"0                \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16
     201             :             "por "MM"0, "MM"4                   \n\t"
     202             :             RESTORE_SIGN(MM"1", MM"0")                // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
     203             :             MOVQ" "MM"0, (%5, %%"FF_REG_a")     \n\t"
     204             :             "pcmpeqw "MM"7, "MM"0               \n\t" // out==0 ? 0xFF : 0x00
     205             :             MOVQ" (%4, %%"FF_REG_a"), "MM"1     \n\t"
     206             :             MOVQ" "MM"7, (%1, %%"FF_REG_a")     \n\t" // 0
     207             :             "pandn "MM"1, "MM"0                 \n\t"
     208             :             PMAXW(MM"0", MM"3")
     209             :             "add $"MMREG_WIDTH", %%"FF_REG_a"   \n\t"
     210             :             " js 1b                             \n\t"
     211             :             PMAX(MM"3", MM"0")
     212             :             "movd "MM"3, %%"FF_REG_a"           \n\t"
     213             :             "movzbl %%al, %%eax                 \n\t" // last_non_zero_p1
     214             :             : "+a" (last_non_zero_p1)
     215           0 :             : "r" (block+64), "r" (qmat+64), "r" (bias+64),
     216           0 :               "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64)
     217             :               XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
     218             :                                 "%xmm4", "%xmm5", "%xmm6", "%xmm7")
     219             :         );
     220             :     }
     221           0 :     __asm__ volatile(
     222             :         "movd %1, "MM"1                     \n\t" // max_qcoeff
     223             :         SPREADW(MM"1")
     224             :         "psubusw "MM"1, "MM"4               \n\t"
     225             :         "packuswb "MM"4, "MM"4              \n\t"
     226             : #if COMPILE_TEMPLATE_SSE2
     227             :         "packsswb "MM"4, "MM"4              \n\t"
     228             : #endif
     229             :         "movd "MM"4, %0                     \n\t" // *overflow
     230             :         : "=g" (*overflow)
     231           0 :         : "g" (s->max_qcoeff)
     232             :     );
     233             : 
     234           0 :     if(s->mb_intra) block[0]= level;
     235           0 :     else            block[0]= temp_block[0];
     236             : 
     237           0 :     if (s->idsp.perm_type == FF_IDCT_PERM_SIMPLE) {
     238           0 :         if(last_non_zero_p1 <= 1) goto end;
     239           0 :         block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08];
     240           0 :         block[0x20] = temp_block[0x10];
     241           0 :         if(last_non_zero_p1 <= 4) goto end;
     242           0 :         block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02];
     243           0 :         block[0x09] = temp_block[0x03];
     244           0 :         if(last_non_zero_p1 <= 7) goto end;
     245           0 :         block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11];
     246           0 :         block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20];
     247           0 :         if(last_non_zero_p1 <= 11) goto end;
     248           0 :         block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12];
     249           0 :         block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04];
     250           0 :         block[0x0C] = temp_block[0x05];
     251           0 :         if(last_non_zero_p1 <= 16) goto end;
     252           0 :         block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13];
     253           0 :         block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21];
     254           0 :         block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30];
     255           0 :         block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22];
     256           0 :         if(last_non_zero_p1 <= 24) goto end;
     257           0 :         block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14];
     258           0 :         block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06];
     259           0 :         block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E];
     260           0 :         block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C];
     261           0 :         if(last_non_zero_p1 <= 32) goto end;
     262           0 :         block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A];
     263           0 :         block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38];
     264           0 :         block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32];
     265           0 :         block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24];
     266           0 :         if(last_non_zero_p1 <= 40) goto end;
     267           0 :         block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16];
     268           0 :         block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17];
     269           0 :         block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25];
     270           0 :         block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33];
     271           0 :         if(last_non_zero_p1 <= 48) goto end;
     272           0 :         block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
     273           0 :         block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D];
     274           0 :         block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
     275           0 :         block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
     276           0 :         if(last_non_zero_p1 <= 56) goto end;
     277           0 :         block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C];
     278           0 :         block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36];
     279           0 :         block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37];
     280           0 :         block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
     281           0 :     }else if(s->idsp.perm_type == FF_IDCT_PERM_LIBMPEG2){
     282           0 :         if(last_non_zero_p1 <= 1) goto end;
     283           0 :         block[0x04] = temp_block[0x01];
     284           0 :         block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
     285           0 :         if(last_non_zero_p1 <= 4) goto end;
     286           0 :         block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02];
     287           0 :         block[0x05] = temp_block[0x03];
     288           0 :         if(last_non_zero_p1 <= 7) goto end;
     289           0 :         block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11];
     290           0 :         block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
     291           0 :         if(last_non_zero_p1 <= 11) goto end;
     292           0 :         block[0x1C] = temp_block[0x19];
     293           0 :         block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B];
     294           0 :         block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05];
     295           0 :         if(last_non_zero_p1 <= 16) goto end;
     296           0 :         block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13];
     297           0 :         block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21];
     298           0 :         block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
     299           0 :         block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22];
     300           0 :         if(last_non_zero_p1 <= 24) goto end;
     301           0 :         block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14];
     302           0 :         block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06];
     303           0 :         block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E];
     304           0 :         block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C];
     305           0 :         if(last_non_zero_p1 <= 32) goto end;
     306           0 :         block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A];
     307           0 :         block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38];
     308           0 :         block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32];
     309           0 :         block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24];
     310           0 :         if(last_non_zero_p1 <= 40) goto end;
     311           0 :         block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16];
     312           0 :         block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
     313           0 :         block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25];
     314           0 :         block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33];
     315           0 :         if(last_non_zero_p1 <= 48) goto end;
     316           0 :         block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B];
     317           0 :         block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D];
     318           0 :             block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
     319           0 :         block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E];
     320           0 :         if(last_non_zero_p1 <= 56) goto end;
     321           0 :         block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C];
     322           0 :         block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36];
     323           0 :         block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
     324           0 :         block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
     325           0 :     } else if (s->idsp.perm_type == FF_IDCT_PERM_NONE) {
     326           0 :         if(last_non_zero_p1 <= 1) goto end;
     327           0 :         block[0x01] = temp_block[0x01];
     328           0 :         block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
     329           0 :         if(last_non_zero_p1 <= 4) goto end;
     330           0 :         block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02];
     331           0 :         block[0x03] = temp_block[0x03];
     332           0 :         if(last_non_zero_p1 <= 7) goto end;
     333           0 :         block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11];
     334           0 :         block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
     335           0 :         if(last_non_zero_p1 <= 11) goto end;
     336           0 :         block[0x19] = temp_block[0x19];
     337           0 :         block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B];
     338           0 :         block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05];
     339           0 :         if(last_non_zero_p1 <= 16) goto end;
     340           0 :         block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13];
     341           0 :         block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21];
     342           0 :         block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
     343           0 :         block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22];
     344           0 :         if(last_non_zero_p1 <= 24) goto end;
     345           0 :         block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14];
     346           0 :         block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06];
     347           0 :         block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E];
     348           0 :         block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C];
     349           0 :         if(last_non_zero_p1 <= 32) goto end;
     350           0 :         block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A];
     351           0 :         block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38];
     352           0 :         block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32];
     353           0 :         block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
     354           0 :         if(last_non_zero_p1 <= 40) goto end;
     355           0 :         block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16];
     356           0 :         block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
     357           0 :         block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25];
     358           0 :         block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33];
     359           0 :         if(last_non_zero_p1 <= 48) goto end;
     360           0 :         block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
     361           0 :         block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
     362           0 :         block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
     363           0 :         block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E];
     364           0 :         if(last_non_zero_p1 <= 56) goto end;
     365           0 :         block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C];
     366           0 :         block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
     367           0 :         block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
     368           0 :         block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
     369           0 :     } else if (s->idsp.perm_type == FF_IDCT_PERM_TRANSPOSE) {
     370           0 :         if(last_non_zero_p1 <= 1) goto end;
     371           0 :         block[0x08] = temp_block[0x01];
     372           0 :         block[0x01] = temp_block[0x08]; block[0x02] = temp_block[0x10];
     373           0 :         if(last_non_zero_p1 <= 4) goto end;
     374           0 :         block[0x09] = temp_block[0x09]; block[0x10] = temp_block[0x02];
     375           0 :         block[0x18] = temp_block[0x03];
     376           0 :         if(last_non_zero_p1 <= 7) goto end;
     377           0 :         block[0x11] = temp_block[0x0A]; block[0x0A] = temp_block[0x11];
     378           0 :         block[0x03] = temp_block[0x18]; block[0x04] = temp_block[0x20];
     379           0 :         if(last_non_zero_p1 <= 11) goto end;
     380           0 :         block[0x0B] = temp_block[0x19];
     381           0 :         block[0x12] = temp_block[0x12]; block[0x19] = temp_block[0x0B];
     382           0 :         block[0x20] = temp_block[0x04]; block[0x28] = temp_block[0x05];
     383           0 :         if(last_non_zero_p1 <= 16) goto end;
     384           0 :         block[0x21] = temp_block[0x0C]; block[0x1A] = temp_block[0x13];
     385           0 :         block[0x13] = temp_block[0x1A]; block[0x0C] = temp_block[0x21];
     386           0 :         block[0x05] = temp_block[0x28]; block[0x06] = temp_block[0x30];
     387           0 :         block[0x0D] = temp_block[0x29]; block[0x14] = temp_block[0x22];
     388           0 :         if(last_non_zero_p1 <= 24) goto end;
     389           0 :         block[0x1B] = temp_block[0x1B]; block[0x22] = temp_block[0x14];
     390           0 :         block[0x29] = temp_block[0x0D]; block[0x30] = temp_block[0x06];
     391           0 :         block[0x38] = temp_block[0x07]; block[0x31] = temp_block[0x0E];
     392           0 :         block[0x2A] = temp_block[0x15]; block[0x23] = temp_block[0x1C];
     393           0 :         if(last_non_zero_p1 <= 32) goto end;
     394           0 :         block[0x1C] = temp_block[0x23]; block[0x15] = temp_block[0x2A];
     395           0 :         block[0x0E] = temp_block[0x31]; block[0x07] = temp_block[0x38];
     396           0 :         block[0x0F] = temp_block[0x39]; block[0x16] = temp_block[0x32];
     397           0 :         block[0x1D] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
     398           0 :         if(last_non_zero_p1 <= 40) goto end;
     399           0 :         block[0x2B] = temp_block[0x1D]; block[0x32] = temp_block[0x16];
     400           0 :         block[0x39] = temp_block[0x0F]; block[0x3A] = temp_block[0x17];
     401           0 :         block[0x33] = temp_block[0x1E]; block[0x2C] = temp_block[0x25];
     402           0 :         block[0x25] = temp_block[0x2C]; block[0x1E] = temp_block[0x33];
     403           0 :         if(last_non_zero_p1 <= 48) goto end;
     404           0 :         block[0x17] = temp_block[0x3A]; block[0x1F] = temp_block[0x3B];
     405           0 :         block[0x26] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
     406           0 :         block[0x34] = temp_block[0x26]; block[0x3B] = temp_block[0x1F];
     407           0 :         block[0x3C] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
     408           0 :         if(last_non_zero_p1 <= 56) goto end;
     409           0 :         block[0x2E] = temp_block[0x35]; block[0x27] = temp_block[0x3C];
     410           0 :         block[0x2F] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
     411           0 :         block[0x3D] = temp_block[0x2F]; block[0x3E] = temp_block[0x37];
     412           0 :         block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
     413             :     } else {
     414           0 :         av_log(s, AV_LOG_DEBUG, "s->idsp.perm_type: %d\n",
     415           0 :                 (int)s->idsp.perm_type);
     416           0 :         av_assert0(s->idsp.perm_type == FF_IDCT_PERM_NONE ||
     417             :                 s->idsp.perm_type == FF_IDCT_PERM_LIBMPEG2 ||
     418             :                 s->idsp.perm_type == FF_IDCT_PERM_SIMPLE ||
     419             :                 s->idsp.perm_type == FF_IDCT_PERM_TRANSPOSE);
     420             :     }
     421           0 :     end:
     422           0 :     return last_non_zero_p1 - 1;
     423             : }

Generated by: LCOV version 1.13