Skip to content

Commit

Permalink
openjph: final cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
bradh committed Jan 12, 2024
1 parent 7420b64 commit 4e34df9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"WITH_OpenJPEG_ENCODER" : "ON",
"WITH_OpenJPEG_ENCODER_PLUGIN" : "ON",
"WITH_FFMPEG_DECODER" : "ON",
"WITH_FFMPEG_DECODER_PLUGIN" : "ON"
"WITH_FFMPEG_DECODER_PLUGIN" : "ON",
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ For each codec, there are two configuration variables:
* `WITH_{codec}_PLUGIN`: when enabled, the codec is compiled as a separate plugin.

In order to use dynamic plugins, also make sure that `ENABLE_PLUGIN_LOADING` is enabled.
The placeholder `{codec}` can have these values: `LIBDE265`, `X265`, `AOM_DECODER`, `AOM_ENCODER`, `SvtEnc`, `DAV1D`, `FFMPEG_DECODER`, `JPEG_DECODER`, `JPEG_ENCODER`, `KVAZAAR`, `OpenJPEG_DECODER`, `OpenJPEG_ENCODER`.
The placeholder `{codec}` can have these values: `LIBDE265`, `X265`, `AOM_DECODER`, `AOM_ENCODER`, `SvtEnc`, `DAV1D`, `FFMPEG_DECODER`, `JPEG_DECODER`, `JPEG_ENCODER`, `KVAZAAR`, `OpenJPEG_DECODER`, `OpenJPEG_ENCODER`, `OPENJPH_ENCODER`

Further options are:

Expand Down
2 changes: 1 addition & 1 deletion examples/heif_enc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void show_help(const char* argv0)
<< " -A, --avif encode as AVIF (not needed if output filename with .avif suffix is provided)\n"
<< " --jpeg encode as JPEG\n"
<< " --jpeg2000 encode as JPEG 2000 (experimental)\n"
<< " --htj2k encode as High Throughput JPEG 2000 (even more experimental)\n"
<< " --htj2k encode as High Throughput JPEG 2000 (experimental)\n"
#if WITH_UNCOMPRESSED_CODEC
<< " -U, --uncompressed encode as uncompressed image (according to ISO 23001-17) (EXPERIMENTAL)\n"
#endif
Expand Down
14 changes: 4 additions & 10 deletions libheif/plugins/encoder_openjph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ static const int OJPH_PLUGIN_PRIORITY = 80;

struct encoder_struct_ojph
{
// We do this for API reasons. Has no effect at this stage.
int quality = 70;
heif_chroma chroma = heif_chroma_undefined;
bool reversible = false;

// Context
ojph::codestream codestream;
Expand Down Expand Up @@ -231,16 +231,12 @@ void ojph_cleanup_plugin()

//////////// Integer parameter setters

// Note quality is part of the plugin API
// Note quality is part of the plugin API.

struct heif_error ojph_set_parameter_quality(void* encoder_raw, int quality)
{
auto* encoder = (struct encoder_struct_ojph*) encoder_raw;

if (quality < 0 || quality > 100) {
return heif_error_invalid_parameter_value;
}

encoder->quality = quality;

return heif_error_ok;
Expand Down Expand Up @@ -309,7 +305,7 @@ struct heif_error ojph_get_parameter_integer(void *encoder_raw, const char *name
struct heif_error ojph_set_parameter_lossless(void* encoder_raw, int lossless)
{
auto* encoder = (struct encoder_struct_ojph*) encoder_raw;
encoder->reversible = lossless;
encoder->codestream.access_cod().set_reversible(lossless);
return heif_error_ok;
}

Expand Down Expand Up @@ -337,7 +333,7 @@ struct heif_error ojph_set_parameter_boolean(void *encoder_raw, const char *name
struct heif_error ojph_get_parameter_lossless(void* encoder_raw, int* lossless)
{
auto* encoder = (struct encoder_struct_ojph*) encoder_raw;
*lossless = encoder->reversible;
*lossless = encoder->codestream.access_cod().is_reversible();
return heif_error_ok;
}

Expand Down Expand Up @@ -745,8 +741,6 @@ void build_COD(encoder_struct_ojph *encoder)
{
ojph::param_cod cod = encoder->codestream.access_cod();
cod.set_color_transform(false);
// TODO: don't set here - just set on codestream
cod.set_reversible(encoder->reversible);
}

struct heif_error ojph_encode_image(void *encoder_raw, const struct heif_image *image, enum heif_image_input_class image_class)
Expand Down

0 comments on commit 4e34df9

Please sign in to comment.