lavc/dsputil: add missing vsad8 and vsse8 functions
the mpeg encoder would try to use them if vsad or vsse were selected for frame_skip_cmp and frame_skip_threshold or frame_skip_factor were set to values != 0 example: "ffmpeg -i INPUT -c:v mpeg2video -skipcmp vsad -skip_threshold 1 -f null -" Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
28f7b81f9b
commit
ac1077ab50
@ -1277,20 +1277,24 @@ static int vsad_intra ## size ## _c(MpegEncContext *c, \
|
|||||||
VSAD_INTRA(8)
|
VSAD_INTRA(8)
|
||||||
VSAD_INTRA(16)
|
VSAD_INTRA(16)
|
||||||
|
|
||||||
static int vsad16_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2,
|
#define VSAD(size) \
|
||||||
int stride, int h)
|
static int vsad ## size ## _c(MpegEncContext *c, \
|
||||||
{
|
uint8_t *s1, uint8_t *s2, \
|
||||||
int score = 0, x, y;
|
int stride, int h) \
|
||||||
|
{ \
|
||||||
for (y = 1; y < h; y++) {
|
int score = 0, x, y; \
|
||||||
for (x = 0; x < 16; x++)
|
\
|
||||||
score += FFABS(s1[x] - s2[x] - s1[x + stride] + s2[x + stride]);
|
for (y = 1; y < h; y++) { \
|
||||||
s1 += stride;
|
for (x = 0; x < size; x++) \
|
||||||
s2 += stride;
|
score += FFABS(s1[x] - s2[x] - s1[x + stride] + s2[x + stride]); \
|
||||||
}
|
s1 += stride; \
|
||||||
|
s2 += stride; \
|
||||||
return score;
|
} \
|
||||||
|
\
|
||||||
|
return score; \
|
||||||
}
|
}
|
||||||
|
VSAD(8)
|
||||||
|
VSAD(16)
|
||||||
|
|
||||||
#define SQ(a) ((a) * (a))
|
#define SQ(a) ((a) * (a))
|
||||||
#define VSSE_INTRA(size) \
|
#define VSSE_INTRA(size) \
|
||||||
@ -1315,20 +1319,23 @@ static int vsse_intra ## size ## _c(MpegEncContext *c, \
|
|||||||
VSSE_INTRA(8)
|
VSSE_INTRA(8)
|
||||||
VSSE_INTRA(16)
|
VSSE_INTRA(16)
|
||||||
|
|
||||||
static int vsse16_c(MpegEncContext *c, uint8_t *s1, uint8_t *s2,
|
#define VSSE(size) \
|
||||||
int stride, int h)
|
static int vsse ## size ## _c(MpegEncContext *c, uint8_t *s1, uint8_t *s2, \
|
||||||
{
|
int stride, int h) \
|
||||||
int score = 0, x, y;
|
{ \
|
||||||
|
int score = 0, x, y; \
|
||||||
for (y = 1; y < h; y++) {
|
\
|
||||||
for (x = 0; x < 16; x++)
|
for (y = 1; y < h; y++) { \
|
||||||
score += SQ(s1[x] - s2[x] - s1[x + stride] + s2[x + stride]);
|
for (x = 0; x < size; x++) \
|
||||||
s1 += stride;
|
score += SQ(s1[x] - s2[x] - s1[x + stride] + s2[x + stride]); \
|
||||||
s2 += stride;
|
s1 += stride; \
|
||||||
}
|
s2 += stride; \
|
||||||
|
} \
|
||||||
return score;
|
\
|
||||||
|
return score; \
|
||||||
}
|
}
|
||||||
|
VSSE(8)
|
||||||
|
VSSE(16)
|
||||||
|
|
||||||
#define WRAPPER8_16_SQ(name8, name16) \
|
#define WRAPPER8_16_SQ(name8, name16) \
|
||||||
static int name16(MpegEncContext *s, uint8_t *dst, uint8_t *src, \
|
static int name16(MpegEncContext *s, uint8_t *dst, uint8_t *src, \
|
||||||
@ -1668,9 +1675,11 @@ av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
|
|||||||
SET_CMP_FUNC(rd)
|
SET_CMP_FUNC(rd)
|
||||||
SET_CMP_FUNC(bit)
|
SET_CMP_FUNC(bit)
|
||||||
c->vsad[0] = vsad16_c;
|
c->vsad[0] = vsad16_c;
|
||||||
|
c->vsad[1] = vsad8_c;
|
||||||
c->vsad[4] = vsad_intra16_c;
|
c->vsad[4] = vsad_intra16_c;
|
||||||
c->vsad[5] = vsad_intra8_c;
|
c->vsad[5] = vsad_intra8_c;
|
||||||
c->vsse[0] = vsse16_c;
|
c->vsse[0] = vsse16_c;
|
||||||
|
c->vsse[1] = vsse8_c;
|
||||||
c->vsse[4] = vsse_intra16_c;
|
c->vsse[4] = vsse_intra16_c;
|
||||||
c->vsse[5] = vsse_intra8_c;
|
c->vsse[5] = vsse_intra8_c;
|
||||||
c->nsse[0] = nsse16_c;
|
c->nsse[0] = nsse16_c;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user