mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
use a user-visible MACRO for max width/height.
This has been pointed as a useful information to have in the header (for the non VP8-specs savvy ones) Change-Id: I494b1da41dfafce882a94e3677d1cd6206bc504b
This commit is contained in:
parent
d4e9f5598d
commit
7a8d8762c1
@ -26,8 +26,6 @@ extern "C" {
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#define MAX_DIMENSION 16384 // maximum width/height allowed by the spec
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int WebPGetEncoderVersion(void) {
|
||||
@ -329,7 +327,7 @@ int WebPEncode(const WebPConfig* const config, WebPPicture* const pic) {
|
||||
return WebPEncodingSetError(pic, VP8_ENC_ERROR_BAD_DIMENSION);
|
||||
if (pic->y == NULL || pic->u == NULL || pic->v == NULL)
|
||||
return WebPEncodingSetError(pic, VP8_ENC_ERROR_NULL_PARAMETER);
|
||||
if (pic->width >= MAX_DIMENSION || pic->height >= MAX_DIMENSION)
|
||||
if (pic->width > WEBP_MAX_DIMENSION || pic->height > WEBP_MAX_DIMENSION)
|
||||
return WebPEncodingSetError(pic, VP8_ENC_ERROR_BAD_DIMENSION);
|
||||
|
||||
enc = InitEncoder(config, pic);
|
||||
|
@ -167,10 +167,13 @@ typedef enum {
|
||||
VP8_ENC_ERROR_FILE_TOO_BIG, // file is bigger than 4G
|
||||
} WebPEncodingError;
|
||||
|
||||
// maximum width/height allowed (inclusive), in pixels
|
||||
#define WEBP_MAX_DIMENSION 16383
|
||||
|
||||
struct WebPPicture {
|
||||
// input
|
||||
WebPEncCSP colorspace; // colorspace: should be YUV420 for now (=Y'CbCr).
|
||||
int width, height; // dimensions.
|
||||
int width, height; // dimensions (less or equal to WEBP_MAX_DIMENSION)
|
||||
uint8_t *y, *u, *v; // pointers to luma/chroma planes.
|
||||
int y_stride, uv_stride; // luma/chroma strides.
|
||||
uint8_t *a; // pointer to the alpha plane
|
||||
@ -260,8 +263,8 @@ WEBP_EXTERN(int) WebPPictureImportBGRA(
|
||||
// Main call
|
||||
|
||||
// Main encoding call, after config and picture have been initialized.
|
||||
// 'picture' must be less than 16384x16384 in dimension, and the 'config' object
|
||||
// must be a valid one.
|
||||
// 'picture' must be less than 16384x16384 in dimension (cf WEBP_MAX_DIMENSION),
|
||||
// and the 'config' object must be a valid one.
|
||||
// Returns false in case of error, true otherwise.
|
||||
// In case of error, picture->error_code is updated accordingly.
|
||||
WEBP_EXTERN(int) WebPEncode(
|
||||
|
Loading…
Reference in New Issue
Block a user