1cabdff1aSopenharmony_ci/* 2cabdff1aSopenharmony_ci * This file is part of FFmpeg. 3cabdff1aSopenharmony_ci * 4cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or 5cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public 6cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either 7cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version. 8cabdff1aSopenharmony_ci * 9cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful, 10cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 11cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12cabdff1aSopenharmony_ci * Lesser General Public License for more details. 13cabdff1aSopenharmony_ci * 14cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public 15cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software 16cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17cabdff1aSopenharmony_ci */ 18cabdff1aSopenharmony_ci 19cabdff1aSopenharmony_ci#include "config.h" 20cabdff1aSopenharmony_ci#include "libavutil/attributes.h" 21cabdff1aSopenharmony_ci#include "h264chroma.h" 22cabdff1aSopenharmony_ci 23cabdff1aSopenharmony_ci#define BIT_DEPTH 8 24cabdff1aSopenharmony_ci#include "h264chroma_template.c" 25cabdff1aSopenharmony_ci#undef BIT_DEPTH 26cabdff1aSopenharmony_ci 27cabdff1aSopenharmony_ci#define BIT_DEPTH 16 28cabdff1aSopenharmony_ci#include "h264chroma_template.c" 29cabdff1aSopenharmony_ci#undef BIT_DEPTH 30cabdff1aSopenharmony_ci 31cabdff1aSopenharmony_ci#define SET_CHROMA(depth) \ 32cabdff1aSopenharmony_ci c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_ ## depth ## _c; \ 33cabdff1aSopenharmony_ci c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_ ## depth ## _c; \ 34cabdff1aSopenharmony_ci c->put_h264_chroma_pixels_tab[2] = put_h264_chroma_mc2_ ## depth ## _c; \ 35cabdff1aSopenharmony_ci c->put_h264_chroma_pixels_tab[3] = put_h264_chroma_mc1_ ## depth ## _c; \ 36cabdff1aSopenharmony_ci c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_ ## depth ## _c; \ 37cabdff1aSopenharmony_ci c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_ ## depth ## _c; \ 38cabdff1aSopenharmony_ci c->avg_h264_chroma_pixels_tab[2] = avg_h264_chroma_mc2_ ## depth ## _c; \ 39cabdff1aSopenharmony_ci c->avg_h264_chroma_pixels_tab[3] = avg_h264_chroma_mc1_ ## depth ## _c; \ 40cabdff1aSopenharmony_ci 41cabdff1aSopenharmony_ciav_cold void ff_h264chroma_init(H264ChromaContext *c, int bit_depth) 42cabdff1aSopenharmony_ci{ 43cabdff1aSopenharmony_ci if (bit_depth > 8 && bit_depth <= 16) { 44cabdff1aSopenharmony_ci SET_CHROMA(16); 45cabdff1aSopenharmony_ci } else { 46cabdff1aSopenharmony_ci SET_CHROMA(8); 47cabdff1aSopenharmony_ci } 48cabdff1aSopenharmony_ci 49cabdff1aSopenharmony_ci#if ARCH_AARCH64 50cabdff1aSopenharmony_ci ff_h264chroma_init_aarch64(c, bit_depth); 51cabdff1aSopenharmony_ci#elif ARCH_ARM 52cabdff1aSopenharmony_ci ff_h264chroma_init_arm(c, bit_depth); 53cabdff1aSopenharmony_ci#elif ARCH_PPC 54cabdff1aSopenharmony_ci ff_h264chroma_init_ppc(c, bit_depth); 55cabdff1aSopenharmony_ci#elif ARCH_X86 56cabdff1aSopenharmony_ci ff_h264chroma_init_x86(c, bit_depth); 57cabdff1aSopenharmony_ci#elif ARCH_MIPS 58cabdff1aSopenharmony_ci ff_h264chroma_init_mips(c, bit_depth); 59cabdff1aSopenharmony_ci#elif ARCH_LOONGARCH64 60cabdff1aSopenharmony_ci ff_h264chroma_init_loongarch(c, bit_depth); 61cabdff1aSopenharmony_ci#endif 62cabdff1aSopenharmony_ci} 63