Skip to content

Commit

Permalink
Adapt jxrlib changes: use two-level overlap for quality values below …
Browse files Browse the repository at this point in the history
…0.5, add SSIM-optimized quantization table (PSNR is still used for now)
  • Loading branch information
chausner committed Jun 14, 2017
1 parent 1a234f1 commit c1f044f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/save.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static ERR jxrlib_save(const gchar *filename, const Image* image, const SaveOpti
return err;
}

static int qp_table[12][6] = {
static int qp_table[12][6] = { // optimized for PSNR
{ 67, 79, 86, 72, 90, 98 },
{ 59, 74, 80, 64, 83, 89 },
{ 53, 68, 75, 57, 76, 83 },
Expand All @@ -373,6 +373,21 @@ static int qp_table[12][6] = {
{ 2, 5, 6, 2, 5, 6 }
};

/*static int qp_table[12][6] = { // optimized for SSIM
{ 67, 93, 98, 71, 98, 104 },
{ 59, 83, 88, 61, 89, 95 },
{ 50, 76, 81, 53, 85, 90 },
{ 46, 71, 77, 47, 79, 85 },
{ 41, 67, 71, 42, 75, 78 },
{ 34, 59, 65, 35, 66, 72 },
{ 30, 54, 60, 29, 60, 66 },
{ 24, 48, 53, 22, 53, 58 },
{ 18, 39, 45, 17, 43, 48 },
{ 13, 34, 38, 11, 35, 38 },
{ 8, 20, 24, 7, 22, 25 },
{ 2, 5, 6, 2, 5, 6 }
};*/

static void apply_save_options(const SaveOptions* save_options, guint width, guint height, PKPixelFormatGUID pixel_format, gboolean black_one, CWMIStrCodecParam* wmiSCP, CWMIStrCodecParam* wmiSCP_Alpha)
{
gfloat iq_float;
Expand All @@ -398,7 +413,7 @@ static void apply_save_options(const SaveOptions* save_options, guint width, gui
if (iq_float == 1.0f)
wmiSCP->olOverlap = OL_NONE;
else if (save_options->overlap == OVERLAP_AUTO)
wmiSCP->olOverlap = iq_float > 0.4f ? OL_ONE : OL_TWO;
wmiSCP->olOverlap = iq_float >= 0.5f ? OL_ONE : OL_TWO;
else
wmiSCP->olOverlap = save_options->overlap - 1;

Expand Down

0 comments on commit c1f044f

Please sign in to comment.