[PATCH] [MXF] - Add jpeg2000 subdescriptor in MXF file.
Add jpeg2000 subdescriptor in MXF file.
+ for ( comp = 0; comp < component_count; comp++ ) { + avio_write(pb, &sc->j2k_info.j2k_comp_desc[3*comp] , 3); + }
Looks like this could be simplified to just avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*component_count);
+ if (j2k_ncomponents != component_count) { + av_log(s, AV_LOG_ERROR, "Incoherence about components image number.\n"); + }
I again feel this should be a hard error
+ for (comp = 0; comp < j2k_ncomponents; comp++) { + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents] = bytestream2_get_byteu(&g); // Bitdepth for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+1] = bytestream2_get_byteu(&g); // Horizontal sampling for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+2] = bytestream2_get_byteu(&g); // Vertical sampling for each component + }
Could be simplified to a single avio_read() /Tomas
Le 19/12/2023 à 14:36, Tomas Härdin a écrit :
+ for ( comp = 0; comp < component_count; comp++ ) { + avio_write(pb, &sc->j2k_info.j2k_comp_desc[3*comp] , 3); + } Looks like this could be simplified to just
avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*component_count);
+ if (j2k_ncomponents != component_count) { + av_log(s, AV_LOG_ERROR, "Incoherence about components image number.\n"); + } I again feel this should be a hard error
+ for (comp = 0; comp < j2k_ncomponents; comp++) { + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents] = bytestream2_get_byteu(&g); // Bitdepth for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+1] = bytestream2_get_byteu(&g); // Horizontal sampling for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+2] = bytestream2_get_byteu(&g); // Vertical sampling for each component + } Could be simplified to a single avio_read()
/Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Here is the new version of the patch taken into account your remarks. Regards, Cédric Le Barz
ons 2023-12-20 klockan 18:04 +0100 skrev Cédric Le Barz:
Le 19/12/2023 à 14:36, Tomas Härdin a écrit :
+ for ( comp = 0; comp < component_count; comp++ ) { + avio_write(pb, &sc->j2k_info.j2k_comp_desc[3*comp] , 3); + } Looks like this could be simplified to just
avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*component_count);
+ if (j2k_ncomponents != component_count) { + av_log(s, AV_LOG_ERROR, "Incoherence about components image number.\n"); + } I again feel this should be a hard error
+ for (comp = 0; comp < j2k_ncomponents; comp++) { + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents] = bytestream2_get_byteu(&g); // Bitdepth for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+1] = bytestream2_get_byteu(&g); // Horizontal sampling for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+2] = bytestream2_get_byteu(&g); // Vertical sampling for each component + } Could be simplified to a single avio_read()
/Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Here is the new version of the patch taken into account your remarks.
Looks OK. Does this also work with RGB(A)? Seems to not be hardcoded for YUV at least. Higher bitdepths would also be nice, I've been working with lossless RGB48 J2K. Doesn't necessarily need to hold up this patch, just curious. /Tomas
Le 21/12/2023 à 12:11, Tomas Härdin a écrit :
Le 19/12/2023 à 14:36, Tomas Härdin a écrit :
+ for ( comp = 0; comp < component_count; comp++ ) { + avio_write(pb, &sc->j2k_info.j2k_comp_desc[3*comp] , 3); + } Looks like this could be simplified to just
avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*component_count);
+ if (j2k_ncomponents != component_count) { + av_log(s, AV_LOG_ERROR, "Incoherence about components image number.\n"); + } I again feel this should be a hard error
+ for (comp = 0; comp < j2k_ncomponents; comp++) { + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents] = bytestream2_get_byteu(&g); // Bitdepth for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+1] = bytestream2_get_byteu(&g); // Horizontal sampling for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+2] = bytestream2_get_byteu(&g); // Vertical sampling for each component + } Could be simplified to a single avio_read()
/Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". Here is the new version of the patch taken into account your remarks. Looks OK. Does this also work with RGB(A)? Seems to not be hardcoded for YUV at least. Higher bitdepths would also be nice, I've been working with lossless RGB48 J2K. Doesn't necessarily need to hold up
ons 2023-12-20 klockan 18:04 +0100 skrev Cédric Le Barz: this patch, just curious.
/Tomas
Any J2K bitdepth can be handled with this patch (up to 31 bits per component). Concerning RGBA, The JPEG 2000 sub-descriptor can be referenced either by the CDCI picture essence descriptor or the RGBA picture essence descriptor both of which are defined by SMPTE ST 377-1. In this patch it is only referenced by the CDCI as the RGBA essence descriptor is not yet implemented in FFmpeg. Nevertheless, I think it should work too with CDCI essence descriptor : if you have such data, you can try. Cédric
fre 2023-12-22 klockan 09:58 +0100 skrev Cédric Le Barz:
Le 21/12/2023 à 12:11, Tomas Härdin a écrit :
Le 19/12/2023 à 14:36, Tomas Härdin a écrit :
+ for ( comp = 0; comp < component_count; comp++ ) { + avio_write(pb, &sc->j2k_info.j2k_comp_desc[3*comp] , 3); + } Looks like this could be simplified to just
avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*component_count);
+ if (j2k_ncomponents != component_count) { + av_log(s, AV_LOG_ERROR, "Incoherence about components image number.\n"); + } I again feel this should be a hard error
+ for (comp = 0; comp < j2k_ncomponents; comp++) { + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents] = bytestream2_get_byteu(&g); // Bitdepth for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+1] = bytestream2_get_byteu(&g); // Horizontal sampling for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+2] = bytestream2_get_byteu(&g); // Vertical sampling for each component + } Could be simplified to a single avio_read()
/Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". Here is the new version of the patch taken into account your remarks. Looks OK. Does this also work with RGB(A)? Seems to not be hardcoded for YUV at least. Higher bitdepths would also be nice, I've been working with lossless RGB48 J2K. Doesn't necessarily need to hold up
ons 2023-12-20 klockan 18:04 +0100 skrev Cédric Le Barz: this patch, just curious.
/Tomas
Any J2K bitdepth can be handled with this patch (up to 31 bits per component).
Concerning RGBA, The JPEG 2000 sub-descriptor can be referenced either by the CDCI picture essence descriptor or the RGBA picture essence descriptor both of which are defined by SMPTE ST 377-1. In this patch it is only referenced by the CDCI as the RGBA essence descriptor is not yet implemented in FFmpeg. Nevertheless, I think it should work too with CDCI essence descriptor : if you have such data, you can try.
I have one sample at least, muxed by WidgetCo's as-02-wrap. Its descriptor looks like this (via mxfdump): RGBAEssenceDescriptor InstanceUID = {c3bf8d8c-6fd4-4004-83d7-3950ab56e86f} SubDescriptors SubDescriptor = {d2013379-ad4b-4d9e-9531-c3a6d8d59175} SubDescriptor -> Strong Reference to JPEG2000PictureSubDescriptor JPEG2000PictureSubDescriptor InstanceUID = {d2013379-ad4b-4d9e-9531-c3a6d8d59175} Rsiz = 16384 Xsiz = 3840 Ysiz = 2160 XOsiz = 0 YOsiz = 0 XTsiz = 3840 YTsiz = 2160 XTOsiz = 0 YTOsiz = 0 Csiz = 3 PictureComponentSizing PictureComponentSize = Ssiz="15", XRsiz="1", YRsiz="1" PictureComponentSize = Ssiz="15", XRsiz="1", YRsiz="1" PictureComponentSize = Ssiz="15", XRsiz="1", YRsiz="1" CodingStyleDefault = Scod="0", SGcod="ProgressionOrder="2", NumberOfLayers="1", MultipleComponentTransformation="1"", SPcod="DecompositionLevels="5", CodeblockWidth="4", CodeblockHeight="4", CodeblockStyle="64", Transformation="1"", PrecinctSize="" QuantizationDefault = Sqcd="32", SPqcd="152, 160, 160, 168, 160, 160, 168, 160, 160, 168, 160, 160, 160, 152, 152, 160" Unknown ff.e9 [060e2b34.0101.010e.04010603.0e000000] = 52 10 47 10 42 10 00 00 00 00 00 00 00 00 00 00 Unknown ff.e8 [060e2b34.0101.010e.04010603.0f000000] = 00 02 00 00 00 00 00 01 00 00 00 02 00 02 LinkedTrackID = 2 SampleRate = 24/1 ContainerDuration = 1 EssenceContainer = MXF-GC JPEG-2000 Picture Mappings FrameLayout = 0 StoredWidth = 3840 StoredHeight = 2160 AspectRatio = 3840/2160 Gamma = [060e2b34.0401.010d.04010101.010a0000] PictureEssenceCoding = [060e2b34.0401.010d.04010202.03010801] Unknown 32.19 [060e2b34.0101.0109.04010201.01060100] = 06 0e 2b 34 04 01 01 0d 04 01 01 01 03 04 00 00 Unknown ff.fe [060e2b34.0101.010e.04010501.14000000] = 00 00 00 02 Unknown ff.fd [060e2b34.0101.010e.04010501.13000000] = 00 00 00 03 Unknown ff.fc [060e2b34.0101.010e.04010501.15000000] = 00 00 00 04 Unknown ff.fb [060e2b34.0101.010e.04010501.16000000] = 00 00 00 05 VideoLineMap VideoLineMapEntry = <Unknown> VideoLineMapEntry = <Unknown> Unknown ff.fa [060e2b34.0101.010e.04200401.01010000] = 7d 00 40 74 3a 98 75 30 1d 4c 0b b8 Unknown ff.f9 [060e2b34.0101.010e.04200401.01020000] = 3d 13 40 42 Unknown ff.f8 [060e2b34.0101.010e.04200401.01030000] = 00 98 96 80 Unknown ff.f7 [060e2b34.0101.010e.04200401.01040000] = 00 00 00 32 ComponentMaxRef = 65535 ComponentMinRef = 0 ScanningDirection = 0 PixelLayout = <Unknown> A client has received samples which are multiple MXFs, each one containing just a single j2k image. Anyway I will push this patch later today, /Tomas
sön 2023-12-31 klockan 14:16 +0100 skrev Tomas Härdin:
fre 2023-12-22 klockan 09:58 +0100 skrev Cédric Le Barz:
Le 21/12/2023 à 12:11, Tomas Härdin a écrit :
Le 19/12/2023 à 14:36, Tomas Härdin a écrit :
+ for ( comp = 0; comp < component_count; comp++ ) { + avio_write(pb, &sc->j2k_info.j2k_comp_desc[3*comp] , 3); + } Looks like this could be simplified to just
avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*component_count);
+ if (j2k_ncomponents != component_count) { + av_log(s, AV_LOG_ERROR, "Incoherence about components image number.\n"); + } I again feel this should be a hard error
+ for (comp = 0; comp < j2k_ncomponents; comp++) { + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents] = bytestream2_get_byteu(&g); // Bitdepth for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+1] = bytestream2_get_byteu(&g); // Horizontal sampling for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+2] = bytestream2_get_byteu(&g); // Vertical sampling for each component + } Could be simplified to a single avio_read()
/Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". Here is the new version of the patch taken into account your remarks. Looks OK. Does this also work with RGB(A)? Seems to not be hardcoded for YUV at least. Higher bitdepths would also be nice, I've been working with lossless RGB48 J2K. Doesn't necessarily need to hold up
ons 2023-12-20 klockan 18:04 +0100 skrev Cédric Le Barz: this patch, just curious.
/Tomas
Any J2K bitdepth can be handled with this patch (up to 31 bits per component).
Concerning RGBA, The JPEG 2000 sub-descriptor can be referenced either by the CDCI picture essence descriptor or the RGBA picture essence descriptor both of which are defined by SMPTE ST 377-1. In this patch it is only referenced by the CDCI as the RGBA essence descriptor is not yet implemented in FFmpeg. Nevertheless, I think it should work too with CDCI essence descriptor : if you have such data, you can try.
I have one sample at least, muxed by WidgetCo's as-02-wrap. Its descriptor looks like this (via mxfdump):
RGBAEssenceDescriptor InstanceUID = {c3bf8d8c-6fd4-4004-83d7-3950ab56e86f} SubDescriptors SubDescriptor = {d2013379-ad4b-4d9e-9531-c3a6d8d59175} SubDescriptor -> Strong Reference to JPEG2000PictureSubDescriptor JPEG2000PictureSubDescriptor InstanceUID = {d2013379-ad4b-4d9e-9531-c3a6d8d59175} Rsiz = 16384 Xsiz = 3840 Ysiz = 2160 XOsiz = 0 YOsiz = 0 XTsiz = 3840 YTsiz = 2160 XTOsiz = 0 YTOsiz = 0 Csiz = 3 PictureComponentSizing PictureComponentSize = Ssiz="15", XRsiz="1", YRsiz="1" PictureComponentSize = Ssiz="15", XRsiz="1", YRsiz="1" PictureComponentSize = Ssiz="15", XRsiz="1", YRsiz="1" CodingStyleDefault = Scod="0", SGcod="ProgressionOrder="2", NumberOfLayers="1", MultipleComponentTransformation="1"", SPcod="DecompositionLevels="5", CodeblockWidth="4", CodeblockHeight="4", CodeblockStyle="64", Transformation="1"", PrecinctSize="" QuantizationDefault = Sqcd="32", SPqcd="152, 160, 160, 168, 160, 160, 168, 160, 160, 168, 160, 160, 160, 152, 152, 160" Unknown ff.e9 [060e2b34.0101.010e.04010603.0e000000] = 52 10 47 10 42 10 00 00 00 00 00 00 00 00 00 00 Unknown ff.e8 [060e2b34.0101.010e.04010603.0f000000] = 00 02 00 00 00 00 00 01 00 00 00 02 00 02 LinkedTrackID = 2 SampleRate = 24/1 ContainerDuration = 1 EssenceContainer = MXF-GC JPEG-2000 Picture Mappings FrameLayout = 0 StoredWidth = 3840 StoredHeight = 2160 AspectRatio = 3840/2160 Gamma = [060e2b34.0401.010d.04010101.010a0000] PictureEssenceCoding = [060e2b34.0401.010d.04010202.03010801] Unknown 32.19 [060e2b34.0101.0109.04010201.01060100] = 06 0e 2b 34 04 01 01 0d 04 01 01 01 03 04 00 00 Unknown ff.fe [060e2b34.0101.010e.04010501.14000000] = 00 00 00 02 Unknown ff.fd [060e2b34.0101.010e.04010501.13000000] = 00 00 00 03 Unknown ff.fc [060e2b34.0101.010e.04010501.15000000] = 00 00 00 04 Unknown ff.fb [060e2b34.0101.010e.04010501.16000000] = 00 00 00 05 VideoLineMap VideoLineMapEntry = <Unknown> VideoLineMapEntry = <Unknown> Unknown ff.fa [060e2b34.0101.010e.04200401.01010000] = 7d 00 40 74 3a 98 75 30 1d 4c 0b b8 Unknown ff.f9 [060e2b34.0101.010e.04200401.01020000] = 3d 13 40 42 Unknown ff.f8 [060e2b34.0101.010e.04200401.01030000] = 00 98 96 80 Unknown ff.f7 [060e2b34.0101.010e.04200401.01040000] = 00 00 00 32 ComponentMaxRef = 65535 ComponentMinRef = 0 ScanningDirection = 0 PixelLayout = <Unknown>
A client has received samples which are multiple MXFs, each one containing just a single j2k image.
Anyway I will push this patch later today,
Pushed /Tomas
av_pix_fmt_count_planes() in On Thu, Dec 21, 2023 at 3:11 AM Tomas Härdin <git@haerdin.se> wrote:
ons 2023-12-20 klockan 18:04 +0100 skrev Cédric Le Barz:
Le 19/12/2023 à 14:36, Tomas Härdin a écrit :
+ for ( comp = 0; comp < component_count; comp++ ) { + avio_write(pb, &sc->j2k_info.j2k_comp_desc[3*comp] , 3); + } Looks like this could be simplified to just
avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*component_count);
+ if (j2k_ncomponents != component_count) { + av_log(s, AV_LOG_ERROR, "Incoherence about components image number.\n"); + } I again feel this should be a hard error
+ for (comp = 0; comp < j2k_ncomponents; comp++) { + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents] = bytestream2_get_byteu(&g); // Bitdepth for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+1] = bytestream2_get_byteu(&g); // Horizontal sampling for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+2] = bytestream2_get_byteu(&g); // Vertical sampling for each component + } Could be simplified to a single avio_read()
/Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Here is the new version of the patch taken into account your remarks.
Looks OK. Does this also work with RGB(A)? Seems to not be hardcoded for YUV at least. Higher bitdepths would also be nice, I've been working with lossless RGB48 J2K. Doesn't necessarily need to hold up this patch, just curious.
av_pix_fmt_count_planes() in mxf_write_jpeg2000_subdesc() will not work for RGB(A) since the number of planes will not be equal to the number of J2K components. See https://trac.ffmpeg.org/ticket/11267
/Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
sön 2024-10-27 klockan 21:06 -0700 skrev Pierre-Anthony Lemieux:
av_pix_fmt_count_planes() in
On Thu, Dec 21, 2023 at 3:11 AM Tomas Härdin <git@haerdin.se> wrote:
ons 2023-12-20 klockan 18:04 +0100 skrev Cédric Le Barz:
Le 19/12/2023 à 14:36, Tomas Härdin a écrit :
+ for ( comp = 0; comp < component_count; comp++ ) { + avio_write(pb, &sc->j2k_info.j2k_comp_desc[3*comp] , 3); + } Looks like this could be simplified to just
avio_write(pb, sc->j2k_info.j2k_comp_desc, 3*component_count);
+ if (j2k_ncomponents != component_count) { + av_log(s, AV_LOG_ERROR, "Incoherence about components image number.\n"); + } I again feel this should be a hard error
+ for (comp = 0; comp < j2k_ncomponents; comp++) { + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents] = bytestream2_get_byteu(&g); // Bitdepth for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+1] = bytestream2_get_byteu(&g); // Horizontal sampling for each component + sc->j2k_info.j2k_comp_desc[comp*j2k_ncomponents+2] = bytestream2_get_byteu(&g); // Vertical sampling for each component + } Could be simplified to a single avio_read()
/Tomas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Here is the new version of the patch taken into account your remarks.
Looks OK. Does this also work with RGB(A)? Seems to not be hardcoded for YUV at least. Higher bitdepths would also be nice, I've been working with lossless RGB48 J2K. Doesn't necessarily need to hold up this patch, just curious.
av_pix_fmt_count_planes() in mxf_write_jpeg2000_subdesc() will not work for RGB(A) since the number of planes will not be equal to the number of J2K components.
Good catch. I'll send a small patch for it. I see mjpegdec also uses av_pix_fmt_count_planes() for counting components.. /Tomas
participants (3)
-
Cédric Le Barz -
Pierre-Anthony Lemieux -
Tomas Härdin