mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avcodec/snow: Hardcode table to save space
The size of ff_qexp is only 32 bytes, but the code to generate it at runtime takes 47 bytes (GCC 9.3, x64, -O3 in an av_cold function); so just hardcode it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
56df06dd83
commit
a7f4abbc62
@ -123,15 +123,6 @@ int ff_snow_alloc_blocks(SnowContext *s){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold void init_qexp(void){
|
|
||||||
int i;
|
|
||||||
double v=128;
|
|
||||||
|
|
||||||
for(i=0; i<QROOT; i++){
|
|
||||||
ff_qexp[i]= lrintf(v);
|
|
||||||
v *= pow(2, 1.0 / QROOT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride, int b_w, int b_h, int dx, int dy){
|
static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, int stride, int b_w, int b_h, int dx, int dy){
|
||||||
static const uint8_t weight[64]={
|
static const uint8_t weight[64]={
|
||||||
8,7,6,5,4,3,2,1,
|
8,7,6,5,4,3,2,1,
|
||||||
@ -433,7 +424,6 @@ static av_cold void snow_static_init(void)
|
|||||||
for (int i = 0; i < MAX_REF_FRAMES; i++)
|
for (int i = 0; i < MAX_REF_FRAMES; i++)
|
||||||
for (int j = 0; j < MAX_REF_FRAMES; j++)
|
for (int j = 0; j < MAX_REF_FRAMES; j++)
|
||||||
ff_scale_mv_ref[i][j] = 256 * (i + 1) / (j + 1);
|
ff_scale_mv_ref[i][j] = 256 * (i + 1) / (j + 1);
|
||||||
init_qexp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
av_cold int ff_snow_common_init(AVCodecContext *avctx){
|
av_cold int ff_snow_common_init(AVCodecContext *avctx){
|
||||||
|
@ -194,7 +194,7 @@ typedef struct SnowContext{
|
|||||||
|
|
||||||
/* Tables */
|
/* Tables */
|
||||||
extern const uint8_t * const ff_obmc_tab[4];
|
extern const uint8_t * const ff_obmc_tab[4];
|
||||||
extern uint8_t ff_qexp[QROOT];
|
extern const uint8_t ff_qexp[QROOT];
|
||||||
extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
|
extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
|
||||||
|
|
||||||
/* C bits used by mmx/sse2/altivec */
|
/* C bits used by mmx/sse2/altivec */
|
||||||
|
@ -124,8 +124,14 @@ const uint8_t * const ff_obmc_tab[4]= {
|
|||||||
obmc32, obmc16, obmc8, obmc4
|
obmc32, obmc16, obmc8, obmc4
|
||||||
};
|
};
|
||||||
|
|
||||||
/* runtime generated tables */
|
/* ff_qexp[i] = lrintf(128 * 2^(i / QROOT)) with QROOT = 32 */
|
||||||
uint8_t ff_qexp[QROOT];
|
const uint8_t ff_qexp[QROOT] = {
|
||||||
|
128, 131, 134, 137, 140, 143, 146, 149, 152, 156, 159,
|
||||||
|
162, 166, 170, 173, 177, 181, 185, 189, 193, 197, 202,
|
||||||
|
206, 211, 215, 220, 225, 230, 235, 240, 245, 251,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* table generated at runtime */
|
||||||
int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
|
int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user