2014-07-19 02:57:47 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "swscale_internal.h"
|
|
|
|
|
swscale: rename SwsContext to SwsInternal
And preserve the public SwsContext as separate name. The motivation here
is that I want to turn SwsContext into a public struct, while keeping the
internal implementation hidden. Additionally, I also want to be able to
use multiple internal implementations, e.g. for GPU devices.
This commit does not include any functional changes. For the most part, it is
a simple rename. The only complications arise from the public facing API
functions, which preserve their current type (and hence require an additional
unwrapping step internally), and the checkasm test framework, which directly
accesses SwsInternal.
For consistency, the affected functions that need to maintain a distionction
have generally been changed to refer to the SwsContext as *sws, and the
SwsInternal as *c.
In an upcoming commit, I will provide a backing definition for the public
SwsContext, and update `sws_internal()` to dereference the internal struct
instead of merely casting it.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-09 17:44:33 +00:00
|
|
|
void ff_hyscale_fast_c(SwsInternal *c, int16_t *dst, int dstWidth,
|
2014-07-19 02:57:47 +00:00
|
|
|
const uint8_t *src, int srcW, int xInc)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
unsigned int xpos = 0;
|
|
|
|
for (i = 0; i < dstWidth; i++) {
|
|
|
|
register unsigned int xx = xpos >> 16;
|
|
|
|
register unsigned int xalpha = (xpos & 0xFFFF) >> 9;
|
|
|
|
dst[i] = (src[xx] << 7) + (src[xx + 1] - src[xx]) * xalpha;
|
|
|
|
xpos += xInc;
|
|
|
|
}
|
|
|
|
for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--)
|
|
|
|
dst[i] = src[srcW-1]*128;
|
|
|
|
}
|
|
|
|
|
swscale: rename SwsContext to SwsInternal
And preserve the public SwsContext as separate name. The motivation here
is that I want to turn SwsContext into a public struct, while keeping the
internal implementation hidden. Additionally, I also want to be able to
use multiple internal implementations, e.g. for GPU devices.
This commit does not include any functional changes. For the most part, it is
a simple rename. The only complications arise from the public facing API
functions, which preserve their current type (and hence require an additional
unwrapping step internally), and the checkasm test framework, which directly
accesses SwsInternal.
For consistency, the affected functions that need to maintain a distionction
have generally been changed to refer to the SwsContext as *sws, and the
SwsInternal as *c.
In an upcoming commit, I will provide a backing definition for the public
SwsContext, and update `sws_internal()` to dereference the internal struct
instead of merely casting it.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-09 17:44:33 +00:00
|
|
|
void ff_hcscale_fast_c(SwsInternal *c, int16_t *dst1, int16_t *dst2,
|
2014-07-19 02:57:47 +00:00
|
|
|
int dstWidth, const uint8_t *src1,
|
|
|
|
const uint8_t *src2, int srcW, int xInc)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
unsigned int xpos = 0;
|
|
|
|
for (i = 0; i < dstWidth; i++) {
|
|
|
|
register unsigned int xx = xpos >> 16;
|
|
|
|
register unsigned int xalpha = (xpos & 0xFFFF) >> 9;
|
|
|
|
dst1[i] = (src1[xx] * (xalpha ^ 127) + src1[xx + 1] * xalpha);
|
|
|
|
dst2[i] = (src2[xx] * (xalpha ^ 127) + src2[xx + 1] * xalpha);
|
|
|
|
xpos += xInc;
|
|
|
|
}
|
|
|
|
for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) {
|
|
|
|
dst1[i] = src1[srcW-1]*128;
|
|
|
|
dst2[i] = src2[srcW-1]*128;
|
|
|
|
}
|
|
|
|
}
|