>Hi, sorry to bug you all but I'm currently working on a mjp2/J2K
>encoder for FFmpeg using libopenjpeg. I've got RGB working and am
>working on getting YUV420/YUV422/YUV440/YUV444 working and I have a
>question about the value that I should set bpp to. In the
>frames_to_mj2 example code, bpp is always set to 8. Why is that?
>
frames_to_mj2 -h | less
(...)
-D : depth, precision in bits [8 .. 16]; default:8
-C : comment
winfried
>I am writing 16 bit per component images on MacOS X. I set the
>component.prec and bpp to 16. The images save with no problems but
>MacOS Preview (image viewing tool) says that the bit depth is 8.
>
>Is this a bug ?
It is unclear.
Which program do you use for writing?
Which precision does the src file have?
Which type of dst file do you have selected?
winfried
I don't think we're looking at the same frames_to_mj2... I'm looking
at the latest v1.4 sources and I'm not seeing that anywhere.
[edit]
I just saw you write to someone on the mailing list that the 1.4
sources are buggy. Dang. I thought it was the entire image's depth
at first. Doesn't look like it. Is the bpp per component,
individually, though? i.e. for YUV420 would bpp be 8 for the first
component, 2 for the second component, and 2 for the third component?
Or would bpp be 8 for each component? I'm just confused if the bpp
for each component is with respect to the image as a whole (i.e. if
one component holding Cb has a size of 640x480, while the image as a
while has a size of 1280x960, then that one component has a bpp that's
1/4 as the bpp as the Y).
I hope I've explained my confusion clearly.
Thanks,
Michael
I meant "if one component holding Cb has a size of 640x480, while the
image as a *whole has a size of 1280x960, then that one component has
a bpp that's 1/4 as the bpp as the Y"
Sorry about that.
the following lines refer to revision 1079 of
svn co \
http://openjpeg.googlecode.com/svn/branches/openjpeg-1.5 \
your-dir
frames_to_mj2.c:
================
line 254:
int prec = 8;/* DEFAULT */
line 610:
case 'D': /* Depth: the precision */
if(sscanf(opj_optarg, "%d", &prec) != 1) prec = 0;
line 675:
mj2_parameters.prec = prec;
line 749:
tk->depth = prec;
line 763:
yuvtoimage(tk, img, sampleno, j2k_parameters,
mj2_parameters.infile)
mj2_convert.c:
================
line 119:
is_16 = (tk->depth > 8);
prec_bytes = (is_16?2:1);
For a prec <= 8: one byte is read
For a prec > 8: two bytes are read
That means: '-D' informs about the precision of the INPUT file.
winfried