/* * Simple IDCT MMX * * Copyright (c) 2001, 2002 Michael Niedermayer * * This file is part of Libav. * * Libav is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * Libav is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/internal.h" #include "libavutil/mem.h" #include "libavutil/x86/asm.h" #include "libavcodec/idctdsp.h" #include "idctdsp.h" #include "simple_idct.h" #if HAVE_INLINE_ASM /* 23170.475006 22725.260826 21406.727617 19265.545870 16384.000000 12872.826198 8866.956905 4520.335430 */ #define C0 23170 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 #define C1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 #define C2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 #define C3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 #define C4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) - 0.5 #define C5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 #define C6 8867 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 #define C7 4520 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 #define ROW_SHIFT 11 #define COL_SHIFT 20 // 6 DECLARE_ASM_CONST(8, uint64_t, wm1010)= 0xFFFF0000FFFF0000ULL; DECLARE_ASM_CONST(8, uint64_t, d40000)= 0x0000000000040000ULL; DECLARE_ALIGNED(8, static const int16_t, coeffs)[]= { 1<<(ROW_SHIFT-1), 0, 1<<(ROW_SHIFT-1), 0, // 1<<(COL_SHIFT-1), 0, 1<<(COL_SHIFT-1), 0, // 0, 1<<(COL_SHIFT-1-16), 0, 1<<(COL_SHIFT-1-16), 1<<(ROW_SHIFT-1), 1, 1<<(ROW_SHIFT-1), 0, // the 1 = ((1<<(COL_SHIFT-1))/C4)<