2014-02-03 14:29:09 -08:00
|
|
|
/*
|
2014-07-10 00:56:05 +02:00
|
|
|
* This file is part of FFmpeg.
|
2014-02-03 14:29:09 -08:00
|
|
|
*
|
2014-07-10 00:56:05 +02:00
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2014-02-03 14:29:09 -08:00
|
|
|
* 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.
|
|
|
|
|
*
|
2014-07-10 00:56:05 +02:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2014-02-03 14:29:09 -08:00
|
|
|
* 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
|
2014-07-10 00:56:05 +02:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2014-02-03 14:29:09 -08:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef AVCODEC_PIXBLOCKDSP_H
|
|
|
|
|
#define AVCODEC_PIXBLOCKDSP_H
|
|
|
|
|
|
2025-05-27 19:13:45 +02:00
|
|
|
#include <stddef.h>
|
2014-02-03 14:29:09 -08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2025-05-27 21:46:06 +02:00
|
|
|
#define PIXBLOCKDSP_8BPP_GET_PIXELS_SUPPORTS_UNALIGNED \
|
|
|
|
|
!(ARCH_ARM || ARCH_MIPS || ARCH_PPC || ARCH_RISCV)
|
|
|
|
|
|
2014-02-03 14:29:09 -08:00
|
|
|
typedef struct PixblockDSPContext {
|
2024-03-10 17:14:55 +01:00
|
|
|
void (*get_pixels)(int16_t *restrict block /* align 16 */,
|
2025-05-27 21:46:06 +02:00
|
|
|
/* align 16 for > 8 bits; align 8 for <= 8 bits
|
|
|
|
|
* (or 1 if PIXBLOCKDSP_8BPP_GET_PIXELS_SUPPORTS_UNALIGNED is set) */
|
|
|
|
|
const uint8_t *pixels,
|
2016-09-06 16:06:12 +02:00
|
|
|
ptrdiff_t stride);
|
2024-03-10 17:14:55 +01:00
|
|
|
void (*get_pixels_unaligned)(int16_t *restrict block /* align 16 */,
|
2020-05-12 11:22:45 +03:00
|
|
|
const uint8_t *pixels,
|
|
|
|
|
ptrdiff_t stride);
|
2024-03-10 17:14:55 +01:00
|
|
|
void (*diff_pixels)(int16_t *restrict block /* align 16 */,
|
2014-02-03 14:29:09 -08:00
|
|
|
const uint8_t *s1 /* align 8 */,
|
|
|
|
|
const uint8_t *s2 /* align 8 */,
|
2016-09-06 16:06:12 +02:00
|
|
|
ptrdiff_t stride);
|
2024-03-10 17:14:55 +01:00
|
|
|
void (*diff_pixels_unaligned)(int16_t *restrict block /* align 16 */,
|
2017-08-19 23:38:58 +02:00
|
|
|
const uint8_t *s1,
|
|
|
|
|
const uint8_t *s2,
|
|
|
|
|
ptrdiff_t stride);
|
|
|
|
|
|
2014-02-03 14:29:09 -08:00
|
|
|
} PixblockDSPContext;
|
|
|
|
|
|
2025-05-27 19:13:45 +02:00
|
|
|
void ff_pixblockdsp_init(PixblockDSPContext *c, int bits_per_raw_sample);
|
avcodec/pixblockdsp: Improve 8 vs 16 bit check
Before this commit, the input in get_pixels and get_pixels_unaligned
has been treated inconsistenly:
- The generic code treated 9, 10, 12 and 14 bits as 16bit input
(these bits correspond to what FFmpeg's dsputils supported),
everything with <= 8 bits as 8 bit and everything else as 8 bit
when used via AVDCT (which exposes these functions and purports
to support up to 14 bits).
- AARCH64, ARM, PPC and RISC-V, x86 ignore this AVDCT special case.
- RISC-V also ignored the restriction to 9, 10, 12 and 14 for its
16bit check and treated everything > 8 bits as 16bit.
- The mmi MIPS code treats everything as 8 bit when used via
AVDCT (this is certainly broken); otherwise it checks for <= 8 bits.
The msa MIPS code behaves like the generic code.
This commit changes this to treat 9..16 bits as 16 bit input,
everything else as 8 bit (the former because it makes sense,
the latter to preserve the behaviour for external users*).
*: The only internal user of AVDCT (the spp filter) always
uses 8, 9 or 10 bits.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-27 17:09:34 +02:00
|
|
|
void ff_pixblockdsp_init_aarch64(PixblockDSPContext *c,
|
2020-05-13 14:08:58 +03:00
|
|
|
unsigned high_bit_depth);
|
avcodec/pixblockdsp: Improve 8 vs 16 bit check
Before this commit, the input in get_pixels and get_pixels_unaligned
has been treated inconsistenly:
- The generic code treated 9, 10, 12 and 14 bits as 16bit input
(these bits correspond to what FFmpeg's dsputils supported),
everything with <= 8 bits as 8 bit and everything else as 8 bit
when used via AVDCT (which exposes these functions and purports
to support up to 14 bits).
- AARCH64, ARM, PPC and RISC-V, x86 ignore this AVDCT special case.
- RISC-V also ignored the restriction to 9, 10, 12 and 14 for its
16bit check and treated everything > 8 bits as 16bit.
- The mmi MIPS code treats everything as 8 bit when used via
AVDCT (this is certainly broken); otherwise it checks for <= 8 bits.
The msa MIPS code behaves like the generic code.
This commit changes this to treat 9..16 bits as 16 bit input,
everything else as 8 bit (the former because it makes sense,
the latter to preserve the behaviour for external users*).
*: The only internal user of AVDCT (the spp filter) always
uses 8, 9 or 10 bits.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-27 17:09:34 +02:00
|
|
|
void ff_pixblockdsp_init_arm(PixblockDSPContext *c,
|
2014-02-03 14:29:09 -08:00
|
|
|
unsigned high_bit_depth);
|
avcodec/pixblockdsp: Improve 8 vs 16 bit check
Before this commit, the input in get_pixels and get_pixels_unaligned
has been treated inconsistenly:
- The generic code treated 9, 10, 12 and 14 bits as 16bit input
(these bits correspond to what FFmpeg's dsputils supported),
everything with <= 8 bits as 8 bit and everything else as 8 bit
when used via AVDCT (which exposes these functions and purports
to support up to 14 bits).
- AARCH64, ARM, PPC and RISC-V, x86 ignore this AVDCT special case.
- RISC-V also ignored the restriction to 9, 10, 12 and 14 for its
16bit check and treated everything > 8 bits as 16bit.
- The mmi MIPS code treats everything as 8 bit when used via
AVDCT (this is certainly broken); otherwise it checks for <= 8 bits.
The msa MIPS code behaves like the generic code.
This commit changes this to treat 9..16 bits as 16 bit input,
everything else as 8 bit (the former because it makes sense,
the latter to preserve the behaviour for external users*).
*: The only internal user of AVDCT (the spp filter) always
uses 8, 9 or 10 bits.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-27 17:09:34 +02:00
|
|
|
void ff_pixblockdsp_init_ppc(PixblockDSPContext *c,
|
2014-02-03 14:29:09 -08:00
|
|
|
unsigned high_bit_depth);
|
avcodec/pixblockdsp: Improve 8 vs 16 bit check
Before this commit, the input in get_pixels and get_pixels_unaligned
has been treated inconsistenly:
- The generic code treated 9, 10, 12 and 14 bits as 16bit input
(these bits correspond to what FFmpeg's dsputils supported),
everything with <= 8 bits as 8 bit and everything else as 8 bit
when used via AVDCT (which exposes these functions and purports
to support up to 14 bits).
- AARCH64, ARM, PPC and RISC-V, x86 ignore this AVDCT special case.
- RISC-V also ignored the restriction to 9, 10, 12 and 14 for its
16bit check and treated everything > 8 bits as 16bit.
- The mmi MIPS code treats everything as 8 bit when used via
AVDCT (this is certainly broken); otherwise it checks for <= 8 bits.
The msa MIPS code behaves like the generic code.
This commit changes this to treat 9..16 bits as 16 bit input,
everything else as 8 bit (the former because it makes sense,
the latter to preserve the behaviour for external users*).
*: The only internal user of AVDCT (the spp filter) always
uses 8, 9 or 10 bits.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-27 17:09:34 +02:00
|
|
|
void ff_pixblockdsp_init_riscv(PixblockDSPContext *c,
|
2022-09-26 17:52:24 +03:00
|
|
|
unsigned high_bit_depth);
|
avcodec/pixblockdsp: Improve 8 vs 16 bit check
Before this commit, the input in get_pixels and get_pixels_unaligned
has been treated inconsistenly:
- The generic code treated 9, 10, 12 and 14 bits as 16bit input
(these bits correspond to what FFmpeg's dsputils supported),
everything with <= 8 bits as 8 bit and everything else as 8 bit
when used via AVDCT (which exposes these functions and purports
to support up to 14 bits).
- AARCH64, ARM, PPC and RISC-V, x86 ignore this AVDCT special case.
- RISC-V also ignored the restriction to 9, 10, 12 and 14 for its
16bit check and treated everything > 8 bits as 16bit.
- The mmi MIPS code treats everything as 8 bit when used via
AVDCT (this is certainly broken); otherwise it checks for <= 8 bits.
The msa MIPS code behaves like the generic code.
This commit changes this to treat 9..16 bits as 16 bit input,
everything else as 8 bit (the former because it makes sense,
the latter to preserve the behaviour for external users*).
*: The only internal user of AVDCT (the spp filter) always
uses 8, 9 or 10 bits.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-27 17:09:34 +02:00
|
|
|
void ff_pixblockdsp_init_x86(PixblockDSPContext *c,
|
2014-02-03 14:29:09 -08:00
|
|
|
unsigned high_bit_depth);
|
avcodec/pixblockdsp: Improve 8 vs 16 bit check
Before this commit, the input in get_pixels and get_pixels_unaligned
has been treated inconsistenly:
- The generic code treated 9, 10, 12 and 14 bits as 16bit input
(these bits correspond to what FFmpeg's dsputils supported),
everything with <= 8 bits as 8 bit and everything else as 8 bit
when used via AVDCT (which exposes these functions and purports
to support up to 14 bits).
- AARCH64, ARM, PPC and RISC-V, x86 ignore this AVDCT special case.
- RISC-V also ignored the restriction to 9, 10, 12 and 14 for its
16bit check and treated everything > 8 bits as 16bit.
- The mmi MIPS code treats everything as 8 bit when used via
AVDCT (this is certainly broken); otherwise it checks for <= 8 bits.
The msa MIPS code behaves like the generic code.
This commit changes this to treat 9..16 bits as 16 bit input,
everything else as 8 bit (the former because it makes sense,
the latter to preserve the behaviour for external users*).
*: The only internal user of AVDCT (the spp filter) always
uses 8, 9 or 10 bits.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-05-27 17:09:34 +02:00
|
|
|
void ff_pixblockdsp_init_mips(PixblockDSPContext *c,
|
2015-06-14 23:26:26 +05:30
|
|
|
unsigned high_bit_depth);
|
2014-02-03 14:29:09 -08:00
|
|
|
|
|
|
|
|
#endif /* AVCODEC_PIXBLOCKDSP_H */
|