;****************************************************************************** ;* SIMD-optimized HuffYUV functions ;* Copyright (c) 2008 Loren Merritt ;* Copyright (c) 2014 Christophe Gisquet ;* ;* This file is part of FFmpeg. ;* ;* FFmpeg 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. ;* ;* FFmpeg 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 FFmpeg; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** %include "libavutil/x86/x86util.asm" SECTION_RODATA pb_f: times 16 db 15 pb_zzzzzzzz77777777: times 8 db -1 pb_7: times 8 db 7 pb_zzzz3333zzzzbbbb: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11 pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13 SECTION_TEXT ; void ff_add_hfyu_median_pred_mmxext(uint8_t *dst, const uint8_t *top, ; const uint8_t *diff, int w, ; int *left, int *left_top) %macro LSHIFT 2 %if mmsize > 8 pslldq %1, %2 %else psllq %1, 8*(%2) %endif %endmacro %macro RSHIFT 2 %if mmsize > 8 psrldq %1, %2 %else psrlq %1, 8*(%2) %endif %endmacro %macro HFYU_MEDIAN 0 cglobal add_hfyu_median_pred, 6,6,8, dst, top, diff, w, left, left_top movu m0, [topq] mova m2, m0 movd m4, [left_topq] LSHIFT m2, 1 mova m1, m0 por m4, m2 movd m3, [leftq] psubb m0, m4 ; t-tl add dstq, wq add topq, wq add diffq, wq neg wq jmp .skip .loop: movu m4, [topq+wq] mova m0, m4 LSHIFT m4, 1 por m4, m1 mova m1, m0 ; t psubb m0, m4 ; t-tl .skip: movu m2, [diffq+wq] %assign i 0 %rep mmsize mova m4, m0 paddb m4, m3 ; t-tl+l mova m5, m3 pmaxub m3, m1 pminub m5, m1 pminub m3, m4 pmaxub m3, m5 ; median paddb m3, m2 ; +residual %if i==0 mova m7, m3 LSHIFT m7, mmsize-1 %else mova m6, m3 RSHIFT m7, 1 LSHIFT m6, mmsize-1 por m7, m6 %endif %if i