1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00
Files
ffmpeg/libavcodec/bitpacked_dec.h
Devin Heitmueller 508b82c605 avcodec/bitpacked: add x86 SIMD unpacking
Add runtime-dispatched SSSE3 and AVX2 implementations for packed
10-bit YUV 4:2:2. The SSSE3 loop follows the negative-width output-offset
pattern used by v210. The AVX2 loop processes 16 pixels at a time and has
an internal eight-pixel tail.

Both implementations use exact-width input loads and therefore do not
rely on padded input or legal overread. They passed 300 consecutive checkasm
seeds.

Benchmark command:
./tests/checkasm/checkasm --bench --test=bitpackeddec \
    --duration=1000000 51000

Intel Xeon E-2356G, GCC 8.5, NASM 2.15.03:
bitpacked_unpack_yuv422p10_c:      13516.7
bitpacked_unpack_yuv422p10_ssse3:   3415.8 (3.96x)
bitpacked_unpack_yuv422p10_avx2:    2183.1 (6.19x)
2026-10-15 18:46:02 +00:00

43 lines
1.5 KiB
C

/*
* Unpack bit-packed streams to formats supported by FFmpeg
* 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
*/
#ifndef AVCODEC_BITPACKED_DEC_H
#define AVCODEC_BITPACKED_DEC_H
#include <stdint.h>
#include "avcodec.h"
struct BitpackedContext {
int (*decode)(AVCodecContext *avctx, AVFrame *frame,
const AVPacket *pkt);
/* width must be a positive multiple of 8; src contains width * 5 / 2 bytes. */
void (*unpack_yuv422p10)(const uint8_t *src,
uint16_t *y, uint16_t *u, uint16_t *v,
int width);
};
void ff_bitpacked_init_aarch64(struct BitpackedContext *s);
void ff_bitpacked_init_x86(struct BitpackedContext *s);
#endif /* AVCODEC_BITPACKED_DEC_H */