mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
sharpyuv: remove minimum image size from sharpyuv library
libwebp still has a size threshold of 4 pixels in picture_csp_enc.c but the sharpyuv library itself can handle any image size. Change-Id: Ic1c78c8f8fae528395fa46a74f717f47cb13098e
This commit is contained in:
parent
5ecee06f7a
commit
ec9e782a35
@ -14,8 +14,9 @@
|
|||||||
#include "sharpyuv/sharpyuv.h"
|
#include "sharpyuv/sharpyuv.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "src/webp/types.h"
|
#include "src/webp/types.h"
|
||||||
@ -27,7 +28,6 @@
|
|||||||
// Sharp RGB->YUV conversion
|
// Sharp RGB->YUV conversion
|
||||||
|
|
||||||
static const int kNumIterations = 4;
|
static const int kNumIterations = 4;
|
||||||
static const int kMinDimensionIterativeConversion = 4;
|
|
||||||
|
|
||||||
#define YUV_FIX 16 // fixed-point precision for RGB->YUV
|
#define YUV_FIX 16 // fixed-point precision for RGB->YUV
|
||||||
static const int kYuvHalf = 1 << (YUV_FIX - 1);
|
static const int kYuvHalf = 1 << (YUV_FIX - 1);
|
||||||
@ -311,6 +311,8 @@ static int DoSharpArgbToYuv(const uint8_t* r_ptr, const uint8_t* g_ptr,
|
|||||||
fixed_t* target_uv = target_uv_base;
|
fixed_t* target_uv = target_uv_base;
|
||||||
const uint64_t diff_y_threshold = (uint64_t)(3.0 * w * h);
|
const uint64_t diff_y_threshold = (uint64_t)(3.0 * w * h);
|
||||||
int ok;
|
int ok;
|
||||||
|
assert(w > 0);
|
||||||
|
assert(h > 0);
|
||||||
|
|
||||||
if (best_y_base == NULL || best_uv_base == NULL ||
|
if (best_y_base == NULL || best_uv_base == NULL ||
|
||||||
target_y_base == NULL || target_uv_base == NULL ||
|
target_y_base == NULL || target_uv_base == NULL ||
|
||||||
@ -444,8 +446,7 @@ int SharpYuvConvert(const void* r_ptr, const void* g_ptr,
|
|||||||
const int yuv_max = (1 << yuv_bit_depth) - 1;
|
const int yuv_max = (1 << yuv_bit_depth) - 1;
|
||||||
const int sfix = GetPrecisionShift(rgb_bit_depth);
|
const int sfix = GetPrecisionShift(rgb_bit_depth);
|
||||||
|
|
||||||
if (width < kMinDimensionIterativeConversion ||
|
if (width < 1 || height < 1 || width == INT_MAX || height == INT_MAX ||
|
||||||
height < kMinDimensionIterativeConversion ||
|
|
||||||
r_ptr == NULL || g_ptr == NULL || b_ptr == NULL || y_ptr == NULL ||
|
r_ptr == NULL || g_ptr == NULL || b_ptr == NULL || y_ptr == NULL ||
|
||||||
u_ptr == NULL || v_ptr == NULL) {
|
u_ptr == NULL || v_ptr == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user