1cabdff1aSopenharmony_ci/* 2cabdff1aSopenharmony_ci * SIMD-optimized HuffYUV encoding functions 3cabdff1aSopenharmony_ci * Copyright (c) 2000, 2001 Fabrice Bellard 4cabdff1aSopenharmony_ci * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> 5cabdff1aSopenharmony_ci * 6cabdff1aSopenharmony_ci * MMX optimization by Nick Kurshev <nickols_k@mail.ru> 7cabdff1aSopenharmony_ci * 8cabdff1aSopenharmony_ci * This file is part of FFmpeg. 9cabdff1aSopenharmony_ci * 10cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or 11cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public 12cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either 13cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version. 14cabdff1aSopenharmony_ci * 15cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful, 16cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 17cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18cabdff1aSopenharmony_ci * Lesser General Public License for more details. 19cabdff1aSopenharmony_ci * 20cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public 21cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software 22cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23cabdff1aSopenharmony_ci */ 24cabdff1aSopenharmony_ci 25cabdff1aSopenharmony_ci#include "libavutil/attributes.h" 26cabdff1aSopenharmony_ci#include "libavutil/cpu.h" 27cabdff1aSopenharmony_ci#include "libavutil/pixdesc.h" 28cabdff1aSopenharmony_ci#include "libavutil/x86/cpu.h" 29cabdff1aSopenharmony_ci#include "libavcodec/huffyuvencdsp.h" 30cabdff1aSopenharmony_ci 31cabdff1aSopenharmony_civoid ff_diff_int16_sse2(uint16_t *dst, const uint16_t *src1, const uint16_t *src2, 32cabdff1aSopenharmony_ci unsigned mask, int w); 33cabdff1aSopenharmony_civoid ff_diff_int16_avx2(uint16_t *dst, const uint16_t *src1, const uint16_t *src2, 34cabdff1aSopenharmony_ci unsigned mask, int w); 35cabdff1aSopenharmony_civoid ff_sub_hfyu_median_pred_int16_mmxext(uint16_t *dst, const uint16_t *src1, const uint16_t *src2, 36cabdff1aSopenharmony_ci unsigned mask, int w, int *left, int *left_top); 37cabdff1aSopenharmony_ci 38cabdff1aSopenharmony_ciav_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, AVCodecContext *avctx) 39cabdff1aSopenharmony_ci{ 40cabdff1aSopenharmony_ci av_unused int cpu_flags = av_get_cpu_flags(); 41cabdff1aSopenharmony_ci const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(avctx->pix_fmt); 42cabdff1aSopenharmony_ci 43cabdff1aSopenharmony_ci if (EXTERNAL_MMXEXT(cpu_flags) && pix_desc && pix_desc->comp[0].depth<16) { 44cabdff1aSopenharmony_ci c->sub_hfyu_median_pred_int16 = ff_sub_hfyu_median_pred_int16_mmxext; 45cabdff1aSopenharmony_ci } 46cabdff1aSopenharmony_ci 47cabdff1aSopenharmony_ci if (EXTERNAL_SSE2(cpu_flags)) { 48cabdff1aSopenharmony_ci c->diff_int16 = ff_diff_int16_sse2; 49cabdff1aSopenharmony_ci } 50cabdff1aSopenharmony_ci 51cabdff1aSopenharmony_ci if (EXTERNAL_AVX2_FAST(cpu_flags)) { 52cabdff1aSopenharmony_ci c->diff_int16 = ff_diff_int16_avx2; 53cabdff1aSopenharmony_ci } 54cabdff1aSopenharmony_ci} 55