On Thu, 28 Sept 2023 at 17:25, David Miguel Susano Pinto <carandr...@gmail.com> wrote: > [...] > Assuming YCbCr, where with the [-128 127] range black is: > > ycbcr([-128 0 0]) > > I was expecting that zeroing all coefficients of all components and > setting the DC of the first component to: > > -CENTERJSAMPLE / comp_info.quant_table[0].quantval[0] > > was the way to go but that's not it (I just get a slightly darker > grey). >
I found the following on jdct.h: /* [...] * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE). * The DCT outputs are returned scaled up by a factor of 8; they therefore * have a range of +-8K for 8-bit data, +-128K for 12-bit data. This [...] */ and now, setting the DC of the first component to: (-CENTERJSAMPLE * 8) / comp_info.quant_table[0].quantval[0] seems to works fine but this hardcoded 8 seems a bit odd and I'm wondering if it's specified somewhere else. Many thanks David -- You received this message because you are subscribed to the Google Groups "libjpeg-turbo User Discussion/Support" group. To unsubscribe from this group and stop receiving emails from it, send an email to libjpeg-turbo-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/libjpeg-turbo-users/CAPOrs_0Th--8UfoFtRavc0F8dXeofkkGW3KSXL%3D3ysqYYZVSaw%40mail.gmail.com.