mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-25 13:18:22 +01:00
Merge "WebPEncode: clear stats at the start of encode" into 0.2.0
This commit is contained in:
commit
5e7963000a
@ -779,7 +779,7 @@ static int DumpPicture(const WebPPicture* const picture, const char* PGM_name) {
|
||||
|
||||
static int ProgressReport(int percent, const WebPPicture* const picture) {
|
||||
printf("[%s]: %3d %% \r",
|
||||
(char*)picture->stats->user_data, percent);
|
||||
(char*)picture->user_data, percent);
|
||||
fflush(stdout);
|
||||
return 1; // all ok
|
||||
}
|
||||
@ -1127,7 +1127,7 @@ int main(int argc, const char *argv[]) {
|
||||
}
|
||||
if (!quiet) {
|
||||
picture.stats = &stats;
|
||||
stats.user_data = (void*)in_file;
|
||||
picture.user_data = (void*)in_file;
|
||||
}
|
||||
|
||||
// Compress
|
||||
|
@ -344,6 +344,8 @@ int WebPEncode(const WebPConfig* config, WebPPicture* pic) {
|
||||
if (pic->width > WEBP_MAX_DIMENSION || pic->height > WEBP_MAX_DIMENSION)
|
||||
return WebPEncodingSetError(pic, VP8_ENC_ERROR_BAD_DIMENSION);
|
||||
|
||||
if (pic->stats != NULL) memset(pic->stats, 0, sizeof(*pic->stats));
|
||||
|
||||
if (!config->lossless) {
|
||||
VP8Encoder* enc = NULL;
|
||||
if (pic->y == NULL || pic->u == NULL || pic->v == NULL) {
|
||||
|
@ -172,9 +172,6 @@ typedef struct {
|
||||
int alpha_data_size; // size of the transparency data
|
||||
int layer_data_size; // size of the enhancement layer data
|
||||
|
||||
void* user_data; // this field is free to be set to any value and
|
||||
// used during callbacks (like progress-report e.g.).
|
||||
|
||||
// lossless encoder statistics
|
||||
uint32_t lossless_features; // bit0:predictor bit1:cross-color transform
|
||||
// bit2:subtract-green bit3:color indexing
|
||||
@ -301,6 +298,9 @@ struct WebPPicture {
|
||||
// If not NULL, report progress during encoding.
|
||||
WebPProgressHook progress_hook;
|
||||
|
||||
void* user_data; // this field is free to be set to any value and
|
||||
// used during callbacks (like progress-report e.g.).
|
||||
|
||||
uint32_t pad3[3]; // padding for later use
|
||||
|
||||
// Unused for now: original samples (for non-YUV420 modes)
|
||||
|
Loading…
Reference in New Issue
Block a user