1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

sws: remove hScale16N() and use ronalds reformated version of it.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-08-14 19:05:03 +02:00
parent 3652409f5b
commit 66bb5cd592
2 changed files with 5 additions and 20 deletions

View File

@ -2057,6 +2057,9 @@ static void hScale16To15_c(SwsContext *c, int16_t *dst, int dstW, const uint8_t
const uint16_t *src = (const uint16_t *) _src;
int sh = av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1;
if(sh<15)
sh= isAnyRGB(c->srcFormat) || c->srcFormat==PIX_FMT_PAL8 ? 13 : av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1;
for (i = 0; i < dstW; i++) {
int j;
int srcPos = filterPos[i];
@ -2089,21 +2092,6 @@ static void hScale8To15_c(SwsContext *c, int16_t *dst, int dstW, const uint8_t *
}
}
static inline void hScale16N_c(int16_t *dst, int dstW, const uint16_t *src, int srcW, int xInc,
const int16_t *filter, const int16_t *filterPos, long filterSize, int shift)
{
int i, j;
for (i=0; i<dstW; i++) {
int srcPos= filterPos[i];
int val=0;
for (j=0; j<filterSize; j++) {
val += ((int)src[srcPos + j])*filter[filterSize*i + j];
}
dst[i] = FFMIN(val>>shift, (1<<15)-1); // the cubic equation does overflow ...
}
}
static inline void hScale16NX_c(int16_t *dst, int dstW, const uint16_t *src, int srcW, int xInc,
const int16_t *filter, const int16_t *filterPos, long filterSize, int shift)
{
@ -2945,9 +2933,6 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
if (c->srcBpc == 8) {
if (c->dstBpc <= 10) {
if((isAnyRGB(c->srcFormat) && av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1<15)
|| c->srcFormat == PIX_FMT_PAL8)
c->hScale16= hScale16N_c;
c->hScale = hScale8To15_c;
if (c->flags & SWS_FAST_BILINEAR) {
c->hyscale_fast = hyscale_fast_c;
@ -2955,7 +2940,7 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
}
} else {
c->hScale = hScale8To19_c;
av_assert0(c->hScale16 != hScale16N_c && c->hScale16 != hScale16NX_c);
av_assert0(c->hScale16 != hScale16NX_c);
}
} else {
if(c->dstBpc > 10){

View File

@ -848,7 +848,7 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
c->dstBpc = 1 + av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1;
if (c->dstBpc < 8)
c->dstBpc = 8;
if (isAnyRGB(srcFormat) && c->dstBpc == 16)
if (isAnyRGB(srcFormat) || srcFormat == PIX_FMT_PAL8)
c->srcBpc = 16;
if (c->dstBpc == 16)
dst_stride <<= 1;