This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

JPEG Encoder Output Format Problem

I've noticed an issue with the JPEG Encoder Codec's output format.  The C64x+ JPEG Baseline Profile Encoder user's guide states on page 37 regarding the forceChromaFormat field:  If set to XDM_DEFAULT, the output color format matches the input color format.

What I have seen is that if I set this forceChromaField equal to XDM_DEFAULT, and then I use an input format of XDM_GRAY - my output is in XDM_GRAY format as expected.  However, if I then try to encode a frame with a format of XDM_YUV_422P, the output will remain XDM_GRAY.  If I try this sequence reversed, my first frame will come out as expected in XDM_YUV_422P format but then my second frame will error out when attempting to set the input format to XDM_GRAY.

Am I misinterpreting the statement in bold above?  The way I understand it, whatever input format I set for the frame should be the output format as well when setting forceChromaField = XDM_DEFAULT.  However, the codec seems to match the input format on its first call, and then stays with that format for each subsequent call.

  • I have not done much work this low level with the JPEG encoder, so this may not be the best answer, but my interpretation is that the forceChromaFormat field is part of a codec instantiation structure, IMGENC1_Params, so it is not something that is flexible at run time, it is expecting you to set this value for the lifetime of the codec instance. My suspicion is that when you set it to XDM_DEFAULT it ends up 'latching' on the first input color format you provide to the codec. In which case the operation you are seeing makes sense since it would output XDM_GRAY indefinitely if the first frame was put in as XDM_GRAY, and it would error out of you started with any of the color outputs and than tried to input XDM_GRAY as the only supported output from XDM_GRAY is XDM_GRAY.

    The idea of latching makes sense from a functional standpoint if the codec is going to be allocating buffers at early on, as buffer sizes are dependent on the color format in addition to the maximum horizontal and vertical resolution.

  • Bernie,

    Thanks.  You're explanation makes sense with regard to how the codec is behaving.  I was hoping that it could be a bit more flexible, but I suppose that's not the case.  I have 2 instances of the codec running at this point to accomplish JPEG compression on both formats, but I was hoping to get away with 1. 

    Thanks again,

    Jason