mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-11-06 21:37:26 +00:00
Use a masked exact-width load and VBMI byte permutations to expand each
40-byte group, then compact the planar Y, U, and V outputs. Handle an
eight-pixel prefix separately so the hot loop can use the negative-width
output-offset pattern from v210.
The AVX-512ICL feature tier is required for vpermb. CPUs with baseline
AVX-512 but without VBMI continue to use AVX2. Reuse one result register for
all three output planes so the function also assembles for 32-bit x86.
The implementation passed 300 consecutive checkasm seeds and assembled
as ELF, Windows COFF, and Mach-O in both 32- and 64-bit modes.
Benchmark command:
./tests/checkasm/checkasm --bench --test=bitpackeddec \
--duration=1000000 60300
Intel Xeon E-2356G, GCC 8.5, NASM 2.15.03:
bitpacked_unpack_yuv422p10_c: 13502.8
bitpacked_unpack_yuv422p10_ssse3: 3436.6 ( 3.93x)
bitpacked_unpack_yuv422p10_avx2: 2222.8 ( 6.07x)
bitpacked_unpack_yuv422p10_avx512icl: 1131.5 (11.93x)
58 lines
2.1 KiB
C
58 lines
2.1 KiB
C
/*
|
|
* Copyright (c) 2026 Devin Heitmueller <dheitmueller@ltnglobal.com>
|
|
*
|
|
* 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 <stdint.h>
|
|
|
|
#include "libavutil/attributes.h"
|
|
#include "libavutil/x86/cpu.h"
|
|
#include "libavcodec/bitpacked_dec.h"
|
|
|
|
void ff_bitpacked_unpack_yuv422p10_ssse3(const uint8_t *src,
|
|
uint16_t *y, uint16_t *u, uint16_t *v,
|
|
int width);
|
|
#if HAVE_AVX2_EXTERNAL
|
|
void ff_bitpacked_unpack_yuv422p10_avx2(const uint8_t *src,
|
|
uint16_t *y, uint16_t *u, uint16_t *v,
|
|
int width);
|
|
#endif
|
|
#if HAVE_AVX512ICL_EXTERNAL
|
|
void ff_bitpacked_unpack_yuv422p10_avx512icl(const uint8_t *src,
|
|
uint16_t *y, uint16_t *u,
|
|
uint16_t *v, int width);
|
|
#endif
|
|
|
|
av_cold void ff_bitpacked_init_x86(struct BitpackedContext *s)
|
|
{
|
|
int cpu_flags = av_get_cpu_flags();
|
|
|
|
if (EXTERNAL_SSSE3(cpu_flags))
|
|
s->unpack_yuv422p10 = ff_bitpacked_unpack_yuv422p10_ssse3;
|
|
|
|
#if HAVE_AVX2_EXTERNAL
|
|
if (EXTERNAL_AVX2(cpu_flags))
|
|
s->unpack_yuv422p10 = ff_bitpacked_unpack_yuv422p10_avx2;
|
|
#endif
|
|
|
|
#if HAVE_AVX512ICL_EXTERNAL
|
|
if (EXTERNAL_AVX512ICL(cpu_flags))
|
|
s->unpack_yuv422p10 = ff_bitpacked_unpack_yuv422p10_avx512icl;
|
|
#endif
|
|
}
|