mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
idctdsp: Add global function pointers for {add|put}_pixels_clamped functions
These function pointers already existed in the ARM code. Adding them globally allows calls to the function pointers to access arch-optimized versions of the functions transparently.
This commit is contained in:
parent
91d305790e
commit
95c0cec03a
@ -29,10 +29,6 @@
|
|||||||
#include "idct.h"
|
#include "idct.h"
|
||||||
#include "idctdsp_arm.h"
|
#include "idctdsp_arm.h"
|
||||||
|
|
||||||
/* XXX: local hack */
|
|
||||||
static void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
|
|
||||||
static void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
|
|
||||||
|
|
||||||
void ff_add_pixels_clamped_arm(const int16_t *block, uint8_t *dest,
|
void ff_add_pixels_clamped_arm(const int16_t *block, uint8_t *dest,
|
||||||
int line_size);
|
int line_size);
|
||||||
|
|
||||||
@ -67,9 +63,6 @@ av_cold void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
|
|||||||
{
|
{
|
||||||
int cpu_flags = av_get_cpu_flags();
|
int cpu_flags = av_get_cpu_flags();
|
||||||
|
|
||||||
ff_put_pixels_clamped = c->put_pixels_clamped;
|
|
||||||
ff_add_pixels_clamped = c->add_pixels_clamped;
|
|
||||||
|
|
||||||
if (!high_bit_depth) {
|
if (!high_bit_depth) {
|
||||||
if (avctx->idct_algo == FF_IDCT_AUTO ||
|
if (avctx->idct_algo == FF_IDCT_AUTO ||
|
||||||
avctx->idct_algo == FF_IDCT_ARM) {
|
avctx->idct_algo == FF_IDCT_ARM) {
|
||||||
|
@ -59,5 +59,7 @@ void ff_fdct248_islow_8(int16_t *data);
|
|||||||
void ff_fdct248_islow_10(int16_t *data);
|
void ff_fdct248_islow_10(int16_t *data);
|
||||||
|
|
||||||
void ff_j_rev_dct(int16_t *data);
|
void ff_j_rev_dct(int16_t *data);
|
||||||
|
void ff_jref_idct_put(uint8_t *dest, int line_size, int16_t *block);
|
||||||
|
void ff_jref_idct_add(uint8_t *dest, int line_size, int16_t *block);
|
||||||
|
|
||||||
#endif /* AVCODEC_DCT_H */
|
#endif /* AVCODEC_DCT_H */
|
||||||
|
@ -79,6 +79,9 @@ av_cold void ff_init_scantable_permutation(uint8_t *idct_permutation,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
|
||||||
|
void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
|
||||||
|
|
||||||
static void put_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
|
static void put_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
|
||||||
int line_size)
|
int line_size)
|
||||||
{
|
{
|
||||||
@ -141,18 +144,6 @@ static void add_pixels_clamped_c(const int16_t *block, uint8_t *restrict pixels,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jref_idct_put(uint8_t *dest, int line_size, int16_t *block)
|
|
||||||
{
|
|
||||||
ff_j_rev_dct(block);
|
|
||||||
put_pixels_clamped_c(block, dest, line_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void jref_idct_add(uint8_t *dest, int line_size, int16_t *block)
|
|
||||||
{
|
|
||||||
ff_j_rev_dct(block);
|
|
||||||
add_pixels_clamped_c(block, dest, line_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
|
av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
|
const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;
|
||||||
@ -163,8 +154,8 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
|
|||||||
c->idct = ff_simple_idct_10;
|
c->idct = ff_simple_idct_10;
|
||||||
c->perm_type = FF_IDCT_PERM_NONE;
|
c->perm_type = FF_IDCT_PERM_NONE;
|
||||||
} else if (avctx->idct_algo == FF_IDCT_INT) {
|
} else if (avctx->idct_algo == FF_IDCT_INT) {
|
||||||
c->idct_put = jref_idct_put;
|
c->idct_put = ff_jref_idct_put;
|
||||||
c->idct_add = jref_idct_add;
|
c->idct_add = ff_jref_idct_add;
|
||||||
c->idct = ff_j_rev_dct;
|
c->idct = ff_j_rev_dct;
|
||||||
c->perm_type = FF_IDCT_PERM_LIBMPEG2;
|
c->perm_type = FF_IDCT_PERM_LIBMPEG2;
|
||||||
} else if (avctx->idct_algo == FF_IDCT_FAAN) {
|
} else if (avctx->idct_algo == FF_IDCT_FAAN) {
|
||||||
@ -183,6 +174,9 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx)
|
|||||||
c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
|
c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
|
||||||
c->add_pixels_clamped = add_pixels_clamped_c;
|
c->add_pixels_clamped = add_pixels_clamped_c;
|
||||||
|
|
||||||
|
ff_put_pixels_clamped = c->put_pixels_clamped;
|
||||||
|
ff_add_pixels_clamped = c->add_pixels_clamped;
|
||||||
|
|
||||||
if (ARCH_ARM)
|
if (ARCH_ARM)
|
||||||
ff_idctdsp_init_arm(c, avctx, high_bit_depth);
|
ff_idctdsp_init_arm(c, avctx, high_bit_depth);
|
||||||
if (ARCH_PPC)
|
if (ARCH_PPC)
|
||||||
|
@ -95,6 +95,9 @@ typedef struct IDCTDSPContext {
|
|||||||
enum idct_permutation_type perm_type;
|
enum idct_permutation_type perm_type;
|
||||||
} IDCTDSPContext;
|
} IDCTDSPContext;
|
||||||
|
|
||||||
|
extern void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
|
||||||
|
extern void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, int line_size);
|
||||||
|
|
||||||
void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx);
|
void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx);
|
||||||
|
|
||||||
void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
|
void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
|
||||||
|
@ -63,7 +63,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
|
|
||||||
#include "dct.h"
|
#include "dct.h"
|
||||||
|
#include "idctdsp.h"
|
||||||
|
|
||||||
#define EIGHT_BIT_SAMPLES
|
#define EIGHT_BIT_SAMPLES
|
||||||
|
|
||||||
@ -940,3 +942,15 @@ void ff_j_rev_dct(DCTBLOCK data)
|
|||||||
dataptr++; /* advance pointer to next column */
|
dataptr++; /* advance pointer to next column */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ff_jref_idct_put(uint8_t *dest, int line_size, int16_t *block)
|
||||||
|
{
|
||||||
|
ff_j_rev_dct(block);
|
||||||
|
ff_put_pixels_clamped(block, dest, line_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ff_jref_idct_add(uint8_t *dest, int line_size, int16_t *block)
|
||||||
|
{
|
||||||
|
ff_j_rev_dct(block);
|
||||||
|
ff_add_pixels_clamped(block, dest, line_size);
|
||||||
|
}
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
#include "libavutil/internal.h"
|
#include "libavutil/internal.h"
|
||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem.h"
|
||||||
#include "libavutil/x86/asm.h"
|
#include "libavutil/x86/asm.h"
|
||||||
|
|
||||||
|
#include "libavcodec/idctdsp.h"
|
||||||
|
|
||||||
#include "idctdsp.h"
|
#include "idctdsp.h"
|
||||||
#include "simple_idct.h"
|
#include "simple_idct.h"
|
||||||
|
|
||||||
@ -1159,12 +1162,12 @@ void ff_simple_idct_mmx(int16_t *block)
|
|||||||
void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, int16_t *block)
|
void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, int16_t *block)
|
||||||
{
|
{
|
||||||
idct(block);
|
idct(block);
|
||||||
ff_put_pixels_clamped_mmx(block, dest, line_size);
|
ff_put_pixels_clamped(block, dest, line_size);
|
||||||
}
|
}
|
||||||
void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, int16_t *block)
|
void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, int16_t *block)
|
||||||
{
|
{
|
||||||
idct(block);
|
idct(block);
|
||||||
ff_add_pixels_clamped_mmx(block, dest, line_size);
|
ff_add_pixels_clamped(block, dest, line_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_INLINE_ASM */
|
#endif /* HAVE_INLINE_ASM */
|
||||||
|
Loading…
Reference in New Issue
Block a user