You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-10-06 05:47:18 +02:00
avcodec/h264qpel: Don't build unused 2x2 size funcs for bitdepths > 8
The 2x2 put functions are only used by Snow and Snow uses only the eight bit versions. The rest is dead code. Disabling it saved 41277B here. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -20,11 +20,71 @@
|
||||
*/
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "h264qpel.h"
|
||||
|
||||
#define pixeltmp int16_t
|
||||
#define BIT_DEPTH 8
|
||||
#include "h264qpel_template.c"
|
||||
|
||||
static void put_h264_qpel2_h_lowpass_8(uint8_t *dst, const uint8_t *restrict src, int dstStride, int srcStride)
|
||||
{
|
||||
const int h = 2;
|
||||
for (int i = 0; i < h; ++i) {
|
||||
dst[0] = av_clip_uint8(((src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]) + 16) >> 5);
|
||||
dst[1] = av_clip_uint8(((src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]) + 16) >> 5);
|
||||
dst += dstStride;
|
||||
src += srcStride;
|
||||
}
|
||||
}
|
||||
|
||||
static void put_h264_qpel2_v_lowpass_8(uint8_t *dst, const uint8_t *restrict src, int dstStride, int srcStride)
|
||||
{
|
||||
const int w = 2;
|
||||
for (int i = 0; i < w; ++i) {
|
||||
const int srcB = src[-2*srcStride];
|
||||
const int srcA = src[-1*srcStride];
|
||||
const int src0 = src[0 *srcStride];
|
||||
const int src1 = src[1 *srcStride];
|
||||
const int src2 = src[2 *srcStride];
|
||||
const int src3 = src[3 *srcStride];
|
||||
const int src4 = src[4 *srcStride];
|
||||
dst[0*dstStride] = av_clip_uint8(((src0+src1)*20 - (srcA+src2)*5 + (srcB+src3) + 16) >> 5);
|
||||
dst[1*dstStride] = av_clip_uint8(((src1+src2)*20 - (src0+src3)*5 + (srcA+src4) + 16) >> 5);
|
||||
dst++;
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
static void put_h264_qpel2_hv_lowpass_8(uint8_t *dst, pixeltmp *tmp, const uint8_t *restrict src, int dstStride, int tmpStride, int srcStride)
|
||||
{
|
||||
const int h = 2;
|
||||
const int w = 2;
|
||||
src -= 2*srcStride;
|
||||
for (int i = 0; i < h + 5; ++i) {
|
||||
tmp[0] = (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]);
|
||||
tmp[1] = (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]);
|
||||
tmp += tmpStride;
|
||||
src += srcStride;
|
||||
}
|
||||
tmp -= tmpStride*(h+5-2);
|
||||
for (int i = 0; i < w; ++i) {
|
||||
const int tmpB = tmp[-2*tmpStride];
|
||||
const int tmpA = tmp[-1*tmpStride];
|
||||
const int tmp0 = tmp[0 *tmpStride];
|
||||
const int tmp1 = tmp[1 *tmpStride];
|
||||
const int tmp2 = tmp[2 *tmpStride];
|
||||
const int tmp3 = tmp[3 *tmpStride];
|
||||
const int tmp4 = tmp[4 *tmpStride];
|
||||
dst[0*dstStride] = av_clip_uint8(((tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3) + 512) >> 10);
|
||||
dst[1*dstStride] = av_clip_uint8(((tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4) + 512) >> 10);
|
||||
dst++;
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
|
||||
H264_MC(put_, 2)
|
||||
|
||||
#undef BIT_DEPTH
|
||||
|
||||
#define BIT_DEPTH 9
|
||||
@@ -73,7 +133,6 @@ av_cold void ff_h264qpel_init(H264QpelContext *c, int bit_depth)
|
||||
dspfunc2(put_h264_qpel, 0, 16, depth); \
|
||||
dspfunc2(put_h264_qpel, 1, 8, depth); \
|
||||
dspfunc2(put_h264_qpel, 2, 4, depth); \
|
||||
dspfunc2(put_h264_qpel, 3, 2, depth); \
|
||||
dspfunc2(avg_h264_qpel, 0, 16, depth); \
|
||||
dspfunc2(avg_h264_qpel, 1, 8, depth); \
|
||||
dspfunc2(avg_h264_qpel, 2, 4, depth)
|
||||
@@ -81,6 +140,7 @@ av_cold void ff_h264qpel_init(H264QpelContext *c, int bit_depth)
|
||||
switch (bit_depth) {
|
||||
default:
|
||||
SET_QPEL(8);
|
||||
dspfunc2(put_h264_qpel, 3, 2, 8); // only used by Snow
|
||||
break;
|
||||
case 9:
|
||||
SET_QPEL(9);
|
||||
|
@@ -75,81 +75,6 @@ static inline void FUNC(copy_block16)(uint8_t *dst, const uint8_t *restrict src,
|
||||
}
|
||||
|
||||
#define H264_LOWPASS(OPNAME, OP, OP2) \
|
||||
av_unused static void FUNC(OPNAME ## h264_qpel2_h_lowpass)(uint8_t *p_dst, const uint8_t *restrict p_src, int dstStride, int srcStride)\
|
||||
{\
|
||||
const int h=2;\
|
||||
int i;\
|
||||
pixel *dst = (pixel*)p_dst;\
|
||||
const pixel *restrict src = (const pixel*)p_src;\
|
||||
dstStride >>= sizeof(pixel)-1;\
|
||||
srcStride >>= sizeof(pixel)-1;\
|
||||
for(i=0; i<h; i++)\
|
||||
{\
|
||||
OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\
|
||||
OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\
|
||||
dst+=dstStride;\
|
||||
src+=srcStride;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
av_unused static void FUNC(OPNAME ## h264_qpel2_v_lowpass)(uint8_t *_dst, const uint8_t *restrict _src, int dstStride, int srcStride)\
|
||||
{\
|
||||
const int w=2;\
|
||||
int i;\
|
||||
pixel *dst = (pixel*)_dst;\
|
||||
const pixel *restrict src = (const pixel*)_src;\
|
||||
dstStride >>= sizeof(pixel)-1;\
|
||||
srcStride >>= sizeof(pixel)-1;\
|
||||
for(i=0; i<w; i++)\
|
||||
{\
|
||||
const int srcB= src[-2*srcStride];\
|
||||
const int srcA= src[-1*srcStride];\
|
||||
const int src0= src[0 *srcStride];\
|
||||
const int src1= src[1 *srcStride];\
|
||||
const int src2= src[2 *srcStride];\
|
||||
const int src3= src[3 *srcStride];\
|
||||
const int src4= src[4 *srcStride];\
|
||||
OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
|
||||
OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
|
||||
dst++;\
|
||||
src++;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
av_unused static void FUNC(OPNAME ## h264_qpel2_hv_lowpass)(uint8_t *_dst, pixeltmp *tmp, const uint8_t *restrict _src, int dstStride, int tmpStride, int srcStride)\
|
||||
{\
|
||||
const int h=2;\
|
||||
const int w=2;\
|
||||
const int pad = (BIT_DEPTH == 10) ? (-10 * ((1<<BIT_DEPTH)-1)) : 0;\
|
||||
int i;\
|
||||
pixel *dst = (pixel*)_dst;\
|
||||
const pixel *restrict src = (const pixel*)_src;\
|
||||
dstStride >>= sizeof(pixel)-1;\
|
||||
srcStride >>= sizeof(pixel)-1;\
|
||||
src -= 2*srcStride;\
|
||||
for(i=0; i<h+5; i++)\
|
||||
{\
|
||||
tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]) + pad;\
|
||||
tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]) + pad;\
|
||||
tmp+=tmpStride;\
|
||||
src+=srcStride;\
|
||||
}\
|
||||
tmp -= tmpStride*(h+5-2);\
|
||||
for(i=0; i<w; i++)\
|
||||
{\
|
||||
const int tmpB= tmp[-2*tmpStride] - pad;\
|
||||
const int tmpA= tmp[-1*tmpStride] - pad;\
|
||||
const int tmp0= tmp[0 *tmpStride] - pad;\
|
||||
const int tmp1= tmp[1 *tmpStride] - pad;\
|
||||
const int tmp2= tmp[2 *tmpStride] - pad;\
|
||||
const int tmp3= tmp[3 *tmpStride] - pad;\
|
||||
const int tmp4= tmp[4 *tmpStride] - pad;\
|
||||
OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
|
||||
OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
|
||||
dst++;\
|
||||
tmp++;\
|
||||
}\
|
||||
}\
|
||||
static void FUNC(OPNAME ## h264_qpel4_h_lowpass)(uint8_t *_dst, const uint8_t *restrict _src, int dstStride, int srcStride)\
|
||||
{\
|
||||
const int h=4;\
|
||||
@@ -540,7 +465,6 @@ static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc32)(uint8_t *dst, const uint
|
||||
|
||||
H264_LOWPASS(put_ , op_put, op2_put)
|
||||
H264_LOWPASS(avg_ , op_avg, op2_avg)
|
||||
H264_MC(put_, 2)
|
||||
H264_MC(put_, 4)
|
||||
H264_MC(put_, 8)
|
||||
H264_MC(put_, 16)
|
||||
|
@@ -64,7 +64,7 @@ void checkasm_check_h264qpel(void)
|
||||
|
||||
for (bit_depth = 8; bit_depth <= 10; bit_depth++) {
|
||||
ff_h264qpel_init(&h, bit_depth);
|
||||
for (i = 0; i < (op ? 3 : 4); i++) {
|
||||
for (i = 0; i < (op || bit_depth != 8 ? 3 : 4); i++) {
|
||||
int size = 16 >> i;
|
||||
for (j = 0; j < 16; j++)
|
||||
if (check_func(tab[i][j], "%s_h264_qpel_%d_mc%d%d_%d", op_name, size, j & 3, j >> 2, bit_depth)) {
|
||||
|
Reference in New Issue
Block a user