Injecting image data after RAW conversion before JPEG compression - Script Writing - CHDK Forum  

Injecting image data after RAW conversion before JPEG compression

  • 1 Replies
  • 1268 Views
Advertisements
Dear all,

I would like to analyze in detail how JPEG compression is implemented on a Canon camera. So far I read that Canon cameras use a dedicated hardware ASIC called JPCORE for JPEG encoding. Since it is difficult to analyze the hardware, I wonder whether it is possible to instrument the camera for JPEG compression and analyze the resulting JPEG images to controlled variations of the input.

For this purpose, I would like to inject image data before JPEG compression. A related thread describes how to access and modify image data [1]. As far as I understand, however, the solution presented there is about modifying the RAW sensor data before any in-camera processing is applied. By contrast, I would like to control the image data after the usual in-camera processing (demosaicking, whitebalancing, gamma correction, etc.) and just before the final JPEG compression. Is there a hook to modify the image data at this point?

[1] https://chdk.setepontos.com/index.php?topic=13461.msg137491#msg137491

*

Offline reyalp

  • ******
  • 14079
Re: Injecting image data after RAW conversion before JPEG compression
« Reply #1 on: 30 / March / 2023, 17:16:09 »
For this purpose, I would like to inject image data before JPEG compression. A related thread describes how to access and modify image data [1]. As far as I understand, however, the solution presented there is about modifying the RAW sensor data before any in-camera processing is applied. By contrast, I would like to control the image data after the usual in-camera processing (demosaicking, whitebalancing, gamma correction, etc.) and just before the final JPEG compression. Is there a hook to modify the image data at this point?
Not generally. On some very old cameras, it was possible to access an intermediate YUV buffer (see https://chdk.setepontos.com/index.php?topic=4338.msg90451#msg90451) but it seems likely that in many cases it's done as a single operation, without storing a full copy between debayer and demosaic or even necessarily exposing it to the main CPU at all.

FWIW, the Magic Lantern (https://www.magiclantern.fm/) folks seem to have done a fair bit of poking around the jpcore stuff, so you might find additional information on their forum, wiki or discord. (for example, @names_are_hard  qemu branch has some registers identified for emulation https://github.com/reticulatedpines/qemu-eos/blob/qemu-eos-v4.2.1/hw/eos/engine.c ) (edit: fixed link)
« Last Edit: 31 / March / 2023, 01:12:58 by reyalp »
Don't forget what the H stands for.

 

Related Topics