Add predictive filtering option for Alpha.

Add predictive filtering option for Alpha plane.
Valid range for filter option is [0, 5] corresponding to prediction
methods none, horizontal, vertical, gradient & paeth filter.
The prediction method 5 will try all the prediction methods (0 to 4)
and pick the prediction method that gives best compression.

Change-Id: I9244d4a9c5017501a9696c7cec5045f04c16d49b
This commit is contained in:
Vikas Arora
2012-01-05 13:04:30 +05:30
parent e852f83205
commit 252028aaac
13 changed files with 424 additions and 28 deletions

View File

@ -700,6 +700,7 @@ static void HelpLong(void) {
printf(" -map <int> ............. print map of extra info.\n");
printf(" -d <file.pgm> .......... dump the compressed output (PGM file).\n");
printf(" -alpha_method <int> .... Transparency-compression method (0..1)\n");
printf(" -alpha_filter <int> .... predictive filtering for Alpha (0..5)\n");
printf(" -noalpha ............... discard any transparency information.\n");
printf("\n");
@ -793,6 +794,8 @@ int main(int argc, const char *argv[]) {
config.alpha_quality = strtol(argv[++c], NULL, 0);
} else if (!strcmp(argv[c], "-alpha_method") && c < argc - 1) {
config.alpha_compression = strtol(argv[++c], NULL, 0);
} else if (!strcmp(argv[c], "-alpha_filter") && c < argc - 1) {
config.alpha_filtering = strtol(argv[++c], NULL, 0);
} else if (!strcmp(argv[c], "-noalpha")) {
keep_alpha = 0;
} else if (!strcmp(argv[c], "-size") && c < argc - 1) {