ffmpeg/libavcodec/snowdata.h
Andreas Rheinhardt 764e021946 avcodec/snowdata: Add explicit alignment for obmc tables
This is in preparation for adding SSSE3 assembly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-13 12:46:24 +02:00

139 lines
7.9 KiB
C

/*
* Copyright (C) 2004 Michael Niedermayer <michaelni@gmx.at>
* Copyright (C) 2006 Robert Edele <yartrebo@earthlink.net>
*
* 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_SNOWDATA_H
#define AVCODEC_SNOWDATA_H
#include "snow.h"
#include "libavutil/mem_internal.h"
DECLARE_ALIGNED(16, static const uint8_t, obmc32)[1024]={
0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 2, 2, 2, 1, 1, 1, 0,
0, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 10, 10, 9, 8, 8, 7, 7, 6, 5, 5, 4, 3, 3, 2, 2, 1, 0,
0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 14, 13, 12, 11, 10, 9, 8, 7, 7, 6, 5, 4, 3, 2, 1, 0,
1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 17, 16, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1,
1, 2, 3, 5, 6, 8, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 21, 20, 19, 17, 16, 14, 13, 12, 10, 9, 8, 6, 5, 3, 2, 1,
1, 2, 4, 6, 7, 9, 11, 12, 14, 15, 17, 19, 20, 22, 24, 25, 25, 24, 22, 20, 19, 17, 15, 14, 12, 11, 9, 7, 6, 4, 2, 1,
1, 3, 5, 7, 8, 10, 12, 14, 16, 18, 20, 22, 23, 25, 27, 29, 29, 27, 25, 23, 22, 20, 18, 16, 14, 12, 10, 8, 7, 5, 3, 1,
1, 3, 5, 7, 10, 12, 14, 16, 18, 20, 22, 24, 27, 29, 31, 33, 33, 31, 29, 27, 24, 22, 20, 18, 16, 14, 12, 10, 7, 5, 3, 1,
1, 4, 6, 8, 11, 13, 15, 18, 20, 23, 25, 27, 30, 32, 34, 37, 37, 34, 32, 30, 27, 25, 23, 20, 18, 15, 13, 11, 8, 6, 4, 1,
1, 4, 7, 9, 12, 14, 17, 20, 22, 25, 28, 30, 33, 35, 38, 41, 41, 38, 35, 33, 30, 28, 25, 22, 20, 17, 14, 12, 9, 7, 4, 1,
1, 4, 7, 10, 13, 16, 19, 22, 24, 27, 30, 33, 36, 39, 42, 45, 45, 42, 39, 36, 33, 30, 27, 24, 22, 19, 16, 13, 10, 7, 4, 1,
2, 5, 8, 11, 14, 17, 20, 23, 27, 30, 33, 36, 39, 42, 45, 48, 48, 45, 42, 39, 36, 33, 30, 27, 23, 20, 17, 14, 11, 8, 5, 2,
2, 5, 8, 12, 15, 19, 22, 25, 29, 32, 35, 39, 42, 46, 49, 52, 52, 49, 46, 42, 39, 35, 32, 29, 25, 22, 19, 15, 12, 8, 5, 2,
2, 5, 9, 13, 16, 20, 24, 27, 31, 34, 38, 42, 45, 49, 53, 56, 56, 53, 49, 45, 42, 38, 34, 31, 27, 24, 20, 16, 13, 9, 5, 2,
2, 6, 10, 14, 17, 21, 25, 29, 33, 37, 41, 45, 48, 52, 56, 60, 60, 56, 52, 48, 45, 41, 37, 33, 29, 25, 21, 17, 14, 10, 6, 2,
2, 6, 10, 14, 17, 21, 25, 29, 33, 37, 41, 45, 48, 52, 56, 60, 60, 56, 52, 48, 45, 41, 37, 33, 29, 25, 21, 17, 14, 10, 6, 2,
2, 5, 9, 13, 16, 20, 24, 27, 31, 34, 38, 42, 45, 49, 53, 56, 56, 53, 49, 45, 42, 38, 34, 31, 27, 24, 20, 16, 13, 9, 5, 2,
2, 5, 8, 12, 15, 19, 22, 25, 29, 32, 35, 39, 42, 46, 49, 52, 52, 49, 46, 42, 39, 35, 32, 29, 25, 22, 19, 15, 12, 8, 5, 2,
2, 5, 8, 11, 14, 17, 20, 23, 27, 30, 33, 36, 39, 42, 45, 48, 48, 45, 42, 39, 36, 33, 30, 27, 23, 20, 17, 14, 11, 8, 5, 2,
1, 4, 7, 10, 13, 16, 19, 22, 24, 27, 30, 33, 36, 39, 42, 45, 45, 42, 39, 36, 33, 30, 27, 24, 22, 19, 16, 13, 10, 7, 4, 1,
1, 4, 7, 9, 12, 14, 17, 20, 22, 25, 28, 30, 33, 35, 38, 41, 41, 38, 35, 33, 30, 28, 25, 22, 20, 17, 14, 12, 9, 7, 4, 1,
1, 4, 6, 8, 11, 13, 15, 18, 20, 23, 25, 27, 30, 32, 34, 37, 37, 34, 32, 30, 27, 25, 23, 20, 18, 15, 13, 11, 8, 6, 4, 1,
1, 3, 5, 7, 10, 12, 14, 16, 18, 20, 22, 24, 27, 29, 31, 33, 33, 31, 29, 27, 24, 22, 20, 18, 16, 14, 12, 10, 7, 5, 3, 1,
1, 3, 5, 7, 8, 10, 12, 14, 16, 18, 20, 22, 23, 25, 27, 29, 29, 27, 25, 23, 22, 20, 18, 16, 14, 12, 10, 8, 7, 5, 3, 1,
1, 2, 4, 6, 7, 9, 11, 12, 14, 15, 17, 19, 20, 22, 24, 25, 25, 24, 22, 20, 19, 17, 15, 14, 12, 11, 9, 7, 6, 4, 2, 1,
1, 2, 3, 5, 6, 8, 9, 10, 12, 13, 14, 16, 17, 19, 20, 21, 21, 20, 19, 17, 16, 14, 13, 12, 10, 9, 8, 6, 5, 3, 2, 1,
1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 17, 16, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1,
0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 14, 13, 12, 11, 10, 9, 8, 7, 7, 6, 5, 4, 3, 2, 1, 0,
0, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 10, 10, 9, 8, 8, 7, 7, 6, 5, 5, 4, 3, 3, 2, 2, 1, 0,
0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 2, 2, 2, 1, 1, 1, 0,
0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
//error:0.000020
};
DECLARE_ALIGNED(16, static const uint8_t, obmc16)[256]={
0, 1, 1, 2, 2, 3, 3, 4, 4, 3, 3, 2, 2, 1, 1, 0,
1, 2, 4, 5, 7, 8, 10, 11, 11, 10, 8, 7, 5, 4, 2, 1,
1, 4, 6, 9, 11, 14, 16, 19, 19, 16, 14, 11, 9, 6, 4, 1,
2, 5, 9, 12, 16, 19, 23, 26, 26, 23, 19, 16, 12, 9, 5, 2,
2, 7, 11, 16, 20, 25, 29, 34, 34, 29, 25, 20, 16, 11, 7, 2,
3, 8, 14, 19, 25, 30, 36, 41, 41, 36, 30, 25, 19, 14, 8, 3,
3, 10, 16, 23, 29, 36, 42, 49, 49, 42, 36, 29, 23, 16, 10, 3,
4, 11, 19, 26, 34, 41, 49, 56, 56, 49, 41, 34, 26, 19, 11, 4,
4, 11, 19, 26, 34, 41, 49, 56, 56, 49, 41, 34, 26, 19, 11, 4,
3, 10, 16, 23, 29, 36, 42, 49, 49, 42, 36, 29, 23, 16, 10, 3,
3, 8, 14, 19, 25, 30, 36, 41, 41, 36, 30, 25, 19, 14, 8, 3,
2, 7, 11, 16, 20, 25, 29, 34, 34, 29, 25, 20, 16, 11, 7, 2,
2, 5, 9, 12, 16, 19, 23, 26, 26, 23, 19, 16, 12, 9, 5, 2,
1, 4, 6, 9, 11, 14, 16, 19, 19, 16, 14, 11, 9, 6, 4, 1,
1, 2, 4, 5, 7, 8, 10, 11, 11, 10, 8, 7, 5, 4, 2, 1,
0, 1, 1, 2, 2, 3, 3, 4, 4, 3, 3, 2, 2, 1, 1, 0,
//error:0.000015
};
//linear *64
static const uint8_t obmc8[64]={
1, 3, 5, 7, 7, 5, 3, 1,
3, 9, 15, 21, 21, 15, 9, 3,
5, 15, 25, 35, 35, 25, 15, 5,
7, 21, 35, 49, 49, 35, 21, 7,
7, 21, 35, 49, 49, 35, 21, 7,
5, 15, 25, 35, 35, 25, 15, 5,
3, 9, 15, 21, 21, 15, 9, 3,
1, 3, 5, 7, 7, 5, 3, 1,
//error:0.000000
};
//linear *64
static const uint8_t obmc4[16]={
4, 12, 12, 4,
12, 36, 36, 12,
12, 36, 36, 12,
4, 12, 12, 4,
//error:0.000000
};
const int8_t ff_quant3bA[256]={
0, 0, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
};
const uint8_t * const ff_obmc_tab[4]= {
obmc32, obmc16, obmc8, obmc4
};
/* ff_qexp[i] = lrintf(128 * 2^(i / QROOT)) with QROOT = 32 */
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];
#endif /* AVCODEC_SNOW_H */