mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
raise the fixed-point precision for the rescaler
for super-large upscaling factor (32x and up), 20bits was not enough. Change-Id: I7b0d1975d0609948d464cfc3aeff1a70df16dc57
This commit is contained in:
parent
aa87e4e063
commit
416b7a6b95
@ -222,7 +222,7 @@ int WebPPictureCrop(WebPPicture* const pic,
|
||||
//-----------------------------------------------------------------------------
|
||||
// Simple picture rescaler
|
||||
|
||||
#define RFIX 20
|
||||
#define RFIX 30
|
||||
#define MULT(x,y) (((int64_t)(x) * (y) + (1 << (RFIX - 1))) >> RFIX)
|
||||
static inline void ImportRow(const uint8_t* src, int src_width,
|
||||
int32_t* frow, int32_t* irow, int dst_width) {
|
||||
@ -264,7 +264,7 @@ static inline void ImportRow(const uint8_t* src, int src_width,
|
||||
}
|
||||
|
||||
static void ExportRow(int32_t* frow, int32_t* irow, uint8_t* dst, int dst_width,
|
||||
const int yscale, const int fxy_scale) {
|
||||
const int yscale, const int64_t fxy_scale) {
|
||||
int x_out;
|
||||
for (x_out = 0; x_out < dst_width; ++x_out) {
|
||||
const int frac = MULT(frow[x_out], yscale);
|
||||
@ -281,7 +281,7 @@ static void RescalePlane(const uint8_t* src,
|
||||
int32_t* const work) {
|
||||
const int x_expand = (src_width < dst_width);
|
||||
const int fy_scale = (1 << RFIX) / dst_height;
|
||||
const int fxy_scale = x_expand ?
|
||||
const int64_t fxy_scale = x_expand ?
|
||||
((int64_t)dst_height << RFIX) / (dst_width * src_height) :
|
||||
((int64_t)dst_height << RFIX) / (src_width * src_height);
|
||||
int y_accum = src_height;
|
||||
|
Loading…
Reference in New Issue
Block a user