mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
webpdec: s/ExUtil//
PrintWebPError, LoadWebP, DecodeWebP, DecodeWebPIncremental Change-Id: Ie17578b91c7efdf6e5fe63568a95f79788b7f8ee
This commit is contained in:
parent
da573cf490
commit
99542bbf3e
@ -799,7 +799,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
{
|
{
|
||||||
VP8StatusCode status = VP8_STATUS_OK;
|
VP8StatusCode status = VP8_STATUS_OK;
|
||||||
size_t data_size = 0;
|
size_t data_size = 0;
|
||||||
if (!ExUtilLoadWebP(in_file, &data, &data_size, bitstream)) {
|
if (!LoadWebP(in_file, &data, &data_size, bitstream)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,14 +855,14 @@ int main(int argc, const char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (incremental) {
|
if (incremental) {
|
||||||
status = ExUtilDecodeWebPIncremental(data, data_size, verbose, &config);
|
status = DecodeWebPIncremental(data, data_size, verbose, &config);
|
||||||
} else {
|
} else {
|
||||||
status = ExUtilDecodeWebP(data, data_size, verbose, &config);
|
status = DecodeWebP(data, data_size, verbose, &config);
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = (status == VP8_STATUS_OK);
|
ok = (status == VP8_STATUS_OK);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
ExUtilPrintWebPError(in_file, status);
|
PrintWebPError(in_file, status);
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ static void PrintAnimationWarning(const WebPDecoderConfig* const config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExUtilPrintWebPError(const char* const in_file, int status) {
|
void PrintWebPError(const char* const in_file, int status) {
|
||||||
fprintf(stderr, "Decoding of %s failed.\n", in_file);
|
fprintf(stderr, "Decoding of %s failed.\n", in_file);
|
||||||
fprintf(stderr, "Status: %d", status);
|
fprintf(stderr, "Status: %d", status);
|
||||||
if (status >= VP8_STATUS_OK && status <= VP8_STATUS_NOT_ENOUGH_DATA) {
|
if (status >= VP8_STATUS_OK && status <= VP8_STATUS_NOT_ENOUGH_DATA) {
|
||||||
@ -46,9 +46,9 @@ void ExUtilPrintWebPError(const char* const in_file, int status) {
|
|||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExUtilLoadWebP(const char* const in_file,
|
int LoadWebP(const char* const in_file,
|
||||||
const uint8_t** data, size_t* data_size,
|
const uint8_t** data, size_t* data_size,
|
||||||
WebPBitstreamFeatures* bitstream) {
|
WebPBitstreamFeatures* bitstream) {
|
||||||
VP8StatusCode status;
|
VP8StatusCode status;
|
||||||
WebPBitstreamFeatures local_features;
|
WebPBitstreamFeatures local_features;
|
||||||
if (!ImgIoUtilReadFile(in_file, data, data_size)) return 0;
|
if (!ImgIoUtilReadFile(in_file, data, data_size)) return 0;
|
||||||
@ -62,7 +62,7 @@ int ExUtilLoadWebP(const char* const in_file,
|
|||||||
free((void*)*data);
|
free((void*)*data);
|
||||||
*data = NULL;
|
*data = NULL;
|
||||||
*data_size = 0;
|
*data_size = 0;
|
||||||
ExUtilPrintWebPError(in_file, status);
|
PrintWebPError(in_file, status);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -70,8 +70,8 @@ int ExUtilLoadWebP(const char* const in_file,
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
VP8StatusCode ExUtilDecodeWebP(const uint8_t* const data, size_t data_size,
|
VP8StatusCode DecodeWebP(const uint8_t* const data, size_t data_size,
|
||||||
int verbose, WebPDecoderConfig* const config) {
|
int verbose, WebPDecoderConfig* const config) {
|
||||||
Stopwatch stop_watch;
|
Stopwatch stop_watch;
|
||||||
VP8StatusCode status = VP8_STATUS_OK;
|
VP8StatusCode status = VP8_STATUS_OK;
|
||||||
if (config == NULL) return VP8_STATUS_INVALID_PARAM;
|
if (config == NULL) return VP8_STATUS_INVALID_PARAM;
|
||||||
@ -90,7 +90,7 @@ VP8StatusCode ExUtilDecodeWebP(const uint8_t* const data, size_t data_size,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
VP8StatusCode ExUtilDecodeWebPIncremental(
|
VP8StatusCode DecodeWebPIncremental(
|
||||||
const uint8_t* const data, size_t data_size,
|
const uint8_t* const data, size_t data_size,
|
||||||
int verbose, WebPDecoderConfig* const config) {
|
int verbose, WebPDecoderConfig* const config) {
|
||||||
Stopwatch stop_watch;
|
Stopwatch stop_watch;
|
||||||
@ -155,7 +155,7 @@ int ReadWebP(const uint8_t* const data, size_t data_size,
|
|||||||
|
|
||||||
status = WebPGetFeatures(data, data_size, bitstream);
|
status = WebPGetFeatures(data, data_size, bitstream);
|
||||||
if (status != VP8_STATUS_OK) {
|
if (status != VP8_STATUS_OK) {
|
||||||
ExUtilPrintWebPError("input data", status);
|
PrintWebPError("input data", status);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -166,7 +166,7 @@ int ReadWebP(const uint8_t* const data, size_t data_size,
|
|||||||
output_buffer->colorspace = has_alpha ? MODE_YUVA : MODE_YUV;
|
output_buffer->colorspace = has_alpha ? MODE_YUVA : MODE_YUV;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = ExUtilDecodeWebP(data, data_size, 0, &config);
|
status = DecodeWebP(data, data_size, 0, &config);
|
||||||
if (status == VP8_STATUS_OK) {
|
if (status == VP8_STATUS_OK) {
|
||||||
pic->width = output_buffer->width;
|
pic->width = output_buffer->width;
|
||||||
pic->height = output_buffer->height;
|
pic->height = output_buffer->height;
|
||||||
@ -200,7 +200,7 @@ int ReadWebP(const uint8_t* const data, size_t data_size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status != VP8_STATUS_OK) {
|
if (status != VP8_STATUS_OK) {
|
||||||
ExUtilPrintWebPError("input data", status);
|
PrintWebPError("input data", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebPFreeDecBuffer(output_buffer);
|
WebPFreeDecBuffer(output_buffer);
|
||||||
|
@ -27,14 +27,14 @@ struct WebPPicture;
|
|||||||
// Prints an informative error message regarding decode failure of 'in_file'.
|
// Prints an informative error message regarding decode failure of 'in_file'.
|
||||||
// 'status' is treated as a VP8StatusCode and if valid will be printed as a
|
// 'status' is treated as a VP8StatusCode and if valid will be printed as a
|
||||||
// text string.
|
// text string.
|
||||||
void ExUtilPrintWebPError(const char* const in_file, int status);
|
void PrintWebPError(const char* const in_file, int status);
|
||||||
|
|
||||||
// Reads a WebP from 'in_file', returning the contents and size in 'data' and
|
// Reads a WebP from 'in_file', returning the contents and size in 'data' and
|
||||||
// 'data_size'. If not NULL, 'bitstream' is populated using WebPGetFeatures().
|
// 'data_size'. If not NULL, 'bitstream' is populated using WebPGetFeatures().
|
||||||
// Returns true on success.
|
// Returns true on success.
|
||||||
int ExUtilLoadWebP(const char* const in_file,
|
int LoadWebP(const char* const in_file,
|
||||||
const uint8_t** data, size_t* data_size,
|
const uint8_t** data, size_t* data_size,
|
||||||
WebPBitstreamFeatures* bitstream);
|
WebPBitstreamFeatures* bitstream);
|
||||||
|
|
||||||
// Decodes the WebP contained in 'data'.
|
// Decodes the WebP contained in 'data'.
|
||||||
// 'config' is a structure previously initialized by WebPInitDecoderConfig().
|
// 'config' is a structure previously initialized by WebPInitDecoderConfig().
|
||||||
@ -42,11 +42,11 @@ int ExUtilLoadWebP(const char* const in_file,
|
|||||||
// cause decode timing to be reported.
|
// cause decode timing to be reported.
|
||||||
// Returns the decoder status. On success 'config->output' will contain the
|
// Returns the decoder status. On success 'config->output' will contain the
|
||||||
// decoded picture.
|
// decoded picture.
|
||||||
VP8StatusCode ExUtilDecodeWebP(const uint8_t* const data, size_t data_size,
|
VP8StatusCode DecodeWebP(const uint8_t* const data, size_t data_size,
|
||||||
int verbose, WebPDecoderConfig* const config);
|
int verbose, WebPDecoderConfig* const config);
|
||||||
|
|
||||||
// Same as ExUtilDecodeWebP(), but using the incremental decoder.
|
// Same as DecodeWebP(), but using the incremental decoder.
|
||||||
VP8StatusCode ExUtilDecodeWebPIncremental(
|
VP8StatusCode DecodeWebPIncremental(
|
||||||
const uint8_t* const data, size_t data_size,
|
const uint8_t* const data, size_t data_size,
|
||||||
int verbose, WebPDecoderConfig* const config);
|
int verbose, WebPDecoderConfig* const config);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user