avcodec/huffyuvenc : remove code duplication in sub_left_prediction

start of the line (before dsp call), can be merge with width < 32 part
pull/272/head
Martin Vignali 7 years ago
parent 57877f2b44
commit 001173b8ff
  1. 48
      libavcodec/huffyuvenc.c

@ -52,42 +52,30 @@ static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst,
const uint8_t *src, int w, int left)
{
int i;
int min_width = FFMIN(w, 32);
if (s->bps <= 8) {
if (w < 32) {
for (i = 0; i < w; i++) {
const int temp = src[i];
dst[i] = temp - left;
left = temp;
}
return left;
} else {
for (i = 0; i < 32; i++) {
const int temp = src[i];
dst[i] = temp - left;
left = temp;
}
s->llvidencdsp.diff_bytes(dst + 32, src + 32, src + 31, w - 32);
return src[w-1];
for (i = 0; i < min_width; i++) { /* scalar loop before dsp call */
const int temp = src[i];
dst[i] = temp - left;
left = temp;
}
if (w < 32)
return left;
s->llvidencdsp.diff_bytes(dst + 32, src + 32, src + 31, w - 32);
return src[w-1];
} else {
const uint16_t *src16 = (const uint16_t *)src;
uint16_t *dst16 = ( uint16_t *)dst;
if (w < 32) {
for (i = 0; i < w; i++) {
const int temp = src16[i];
dst16[i] = temp - left;
left = temp;
}
return left;
} else {
for (i = 0; i < 32; i++) {
const int temp = src16[i];
dst16[i] = temp - left;
left = temp;
}
s->hencdsp.diff_int16(dst16 + 32, src16 + 32, src16 + 31, s->n - 1, w - 32);
return src16[w-1];
for (i = 0; i < min_width; i++) { /* scalar loop before dsp call */
const int temp = src16[i];
dst16[i] = temp - left;
left = temp;
}
if (w < 32)
return left;
s->hencdsp.diff_int16(dst16 + 32, src16 + 32, src16 + 31, s->n - 1, w - 32);
return src16[w-1];
}
}

Loading…
Cancel
Save