add WEBP_REDUCE_SIZE

remove auto-filter (-af) support and make WebPPictureCopy,
WebPPictureIsView, WebPPictureView, WebPPictureCrop, and
WebPPictureRescale noops.

Change-Id: If39d512cc268a0015298a1138dbc94feb86575e5
This commit is contained in:
James Zern
2017-11-22 17:35:39 -08:00
parent f593d71a64
commit b299c47eac
6 changed files with 80 additions and 3 deletions

View File

@ -65,6 +65,8 @@ int VP8FilterStrengthFromDelta(int sharpness, int delta) {
//------------------------------------------------------------------------------
// Paragraph 15.4: compute the inner-edge filtering strength
#if !defined(WEBP_REDUCE_SIZE)
static int GetILevel(int sharpness, int level) {
if (sharpness > 0) {
if (sharpness > 4) {
@ -129,11 +131,14 @@ static double GetMBSSIM(const uint8_t* yuv1, const uint8_t* yuv2) {
return sum;
}
#endif // !defined(WEBP_REDUCE_SIZE)
//------------------------------------------------------------------------------
// Exposed APIs: Encoder should call the following 3 functions to adjust
// loop filter strength
void VP8InitFilter(VP8EncIterator* const it) {
#if !defined(WEBP_REDUCE_SIZE)
if (it->lf_stats_ != NULL) {
int s, i;
for (s = 0; s < NUM_MB_SEGMENTS; s++) {
@ -143,9 +148,13 @@ void VP8InitFilter(VP8EncIterator* const it) {
}
VP8SSIMDspInit();
}
#else
(void)it;
#endif
}
void VP8StoreFilterStats(VP8EncIterator* const it) {
#if !defined(WEBP_REDUCE_SIZE)
int d;
VP8Encoder* const enc = it->enc_;
const int s = it->mb_->segment_;
@ -177,10 +186,14 @@ void VP8StoreFilterStats(VP8EncIterator* const it) {
DoFilter(it, level);
(*it->lf_stats_)[s][level] += GetMBSSIM(it->yuv_in_, it->yuv_out2_);
}
#else // defined(WEBP_REDUCE_SIZE)
(void)it;
#endif // !defined(WEBP_REDUCE_SIZE)
}
void VP8AdjustFilterStrength(VP8EncIterator* const it) {
VP8Encoder* const enc = it->enc_;
#if !defined(WEBP_REDUCE_SIZE)
if (it->lf_stats_ != NULL) {
int s;
for (s = 0; s < NUM_MB_SEGMENTS; s++) {
@ -196,7 +209,10 @@ void VP8AdjustFilterStrength(VP8EncIterator* const it) {
}
enc->dqm_[s].fstrength_ = best_level;
}
} else if (enc->config_->filter_strength > 0) {
return;
}
#endif // !defined(WEBP_REDUCE_SIZE)
if (enc->config_->filter_strength > 0) {
int max_level = 0;
int s;
for (s = 0; s < NUM_MB_SEGMENTS; s++) {

View File

@ -13,7 +13,7 @@
#include "src/webp/encode.h"
#if !defined(WEBP_DISABLE_STATS)
#if !(defined(WEBP_DISABLE_STATS) || defined(WEBP_REDUCE_SIZE))
#include <math.h>
#include <stdlib.h>

View File

@ -11,6 +11,10 @@
//
// Author: Skal (pascal.massimino@gmail.com)
#include "src/webp/encode.h"
#if !defined(WEBP_REDUCE_SIZE)
#include <assert.h>
#include <stdlib.h>
@ -261,4 +265,45 @@ int WebPPictureRescale(WebPPicture* pic, int width, int height) {
return 1;
}
//------------------------------------------------------------------------------
#else // defined(WEBP_REDUCE_SIZE)
int WebPPictureCopy(const WebPPicture* src, WebPPicture* dst) {
(void)src;
(void)dst;
return 0;
}
int WebPPictureIsView(const WebPPicture* picture) {
(void)picture;
return 0;
}
int WebPPictureView(const WebPPicture* src,
int left, int top, int width, int height,
WebPPicture* dst) {
(void)src;
(void)left;
(void)top;
(void)width;
(void)height;
(void)dst;
return 0;
}
int WebPPictureCrop(WebPPicture* pic,
int left, int top, int width, int height) {
(void)pic;
(void)left;
(void)top;
(void)width;
(void)height;
return 0;
}
int WebPPictureRescale(WebPPicture* pic, int width, int height) {
(void)pic;
(void)width;
(void)height;
return 0;
}
#endif // !defined(WEBP_REDUCE_SIZE)