View Bug Details

IDProjectCategoryView StatusLast Update
0002255libdcpPackagingpublic2022-12-06 21:21
Reporterbradel Assigned Tocarl  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platform64-bitOSLinuxOS VersionArch
Summary0002255: Making libdcp compatible with openjpeg 2.5
Description

Dear Carl,

I am working together with Markus to provide DCPoMatic 2.16 to Arch Linux Users.
As far as I understand you patched libopenjp2 to provide the Guard Bits required by SMPTE standard for 2k DCPs. However, since version 2.5 of openjpeg, upstream has introduced an option to specify the number of guard bits with a slightly different syntax. Therefore, I wrote the attached patch which makes libdcp compatible with the upstream version of openjpeg 2.5, which is also the current version in Arch Linux.
I would like to ask you if you think we can proceed with patching libdcp to work with the native libopenjp2 or is there something else we are missing?

Thank you very much for your work on DCPoMatic!
(Sorry for reporting this as minor issue, but I did not find an adequate category for this "bug")

Best regards,
Benjamin

TagsNo tags attached.

Activities

bradel

2022-05-19 13:19

reporter  

0001-fix-compile-with-openjp25.patch (853 bytes)   
--- a/src/j2k_transcode.cc	2022-05-17 10:07:44.525679224 +0200
+++ b/src/j2k_transcode.cc	2022-05-17 10:04:18.846330309 +0200
@@ -46,7 +46,7 @@
 #include <openjpeg.h>
 #include <cmath>
 #include <iostream>
-
+#include <string>
 
 using std::min;
 using std::pow;
@@ -315,10 +315,13 @@
 	parameters.max_comp_size = parameters.max_cs_size / 1.25;
 	parameters.tcp_numlayers = 1;
 	parameters.tcp_mct = 1;
-	parameters.numgbits = fourk ? 2 : 1;
+	string numgbits = "GUARD_BITS=";
+	numgbits.append(std::to_string(fourk ? 2 : 1));
+	const char* extraopt[] { numgbits.data(), nullptr };
 
 	/* Setup the encoder parameters using the current image and user parameters */
 	opj_setup_encoder (encoder, &parameters, xyz->opj_image());
+	opj_encoder_set_extra_options(encoder, extraopt);
 
 	auto stream = opj_stream_default_create (OPJ_FALSE);
 	if (!stream) {

carl

2022-05-19 16:09

administrator   ~0005031

Thanks, I will take a look.

carl

2022-12-06 21:21

administrator   ~0005356

Sorry for the delay in getting to this. I merged a change like yours to libdcp v1.8.37, so it should now build with libopenjpeg 2.5.

The last time I checked, the optimisations in the DCP-o-matic "bundled" version of openjpeg were slightly more effective (at least in the DCP case) than those in openjpeg 2.5, so the bundled version may be a little faster. I need to check this properly though. I don't know of any other problems with the 2.5 release.

Thanks for all the work you do making DCP-o-matic work on Arch, and let me know if there's anything I can to do help!

Bug History

Date Modified Username Field Change
2022-05-19 13:19 bradel New Bug
2022-05-19 13:19 bradel File Added: 0001-fix-compile-with-openjp25.patch
2022-05-19 16:09 carl Assigned To => carl
2022-05-19 16:09 carl Status new => acknowledged
2022-05-19 16:09 carl Note Added: 0005031
2022-12-06 21:21 carl Note Added: 0005356
2022-12-06 21:21 carl Status acknowledged => resolved
2022-12-06 21:21 carl Resolution open => fixed