Image quality and its effect on memory (more RAM 4 free)

Started by theBilalFakhouri, June 15, 2022, 06:37:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

theBilalFakhouri

After these, I was reading into SRM job memory buffers, then one of Greg's legacies showed:

Quote from: Greg on July 10, 2014, 09:10:03 PM
On the 500D picture quality (jpg raw) has an effect on the SRM.

             Photo mode          Movie mode
RAW         4x26MB                 2x26MB
JPG           3x26MB                 1x26MB

It seems "Image quality" does have an effect not only on SRM, on shoot memory too, so on 100D/700D (video mode):
           
             Shoot memory       SRM memory           Total
JPG        91 MB                     31x1 MB                   122 MB
RAW      95 MB                     31x2 MB                    157 MB ( +28% / +35MB more memory :) )


A given reason which make sense why this is happening:
Quote from: josepvm on July 10, 2014, 11:30:14 PM
So it seems the camera reserves one SRM buffer to convert the image to JPEG.

The camera reserves more memory as preparation for RAW to JPEG conversion step while shooting Still pictures in JPEG format. Or it might be there another reason too which we don't know.


-Results on 700D:

-1736x2214 @ 11 bit-lossless at 23.976 FPS, 240 MHz overclock, no GD (~78MB/s required write speed):

JPG:  first clip: 1 Minutes and 54 Seconds, second clip: 1 Minutes and 13 Seconds.
RAW: I have to stop it manually after 6 Minutes of recording :D

I didn't make tests on 5D3, I might expect an increase too, also for other models.

-How to check available memory and the increase:

1-Unload all modules (RAW video and crop mode must be off).
2-Set "Image quality" to JPG from Canon menu/settings.
3-Set the camera to video mode.
4-Restart the camera.
5-From ML settings go to "Debug" tab --> click on "Free memory", wait a little and check:

-shoot total
-SRM job total

And write them down.

Redo steps 2 to 5, but this time Set "Image quality" to RAW.
Share your numbers.

JPG                                                                                                RAW


-Other thing:
By setting Image quality to RAW (gaining more memory) --> this fixes broken "Simple" silent picture on 700D because of more SRM memory.

I don't know why this thing isn't yet adapted in both Silent and mlv_lite/mlv_rec modules, it should be there some kind of warning or something.

-Don't forget setting "Image quality" to RAW before recording RAW video! :D also you must do a camera restart after changing "Image quality" to RAW!, if you don't make a restart you will lose some of shoot memory (on 700D it's 59 MB from 95 MB, so the lost was 36 MB).

mlrocks

amazing, super 35 10bit lossless 5.2k 1x3 raw over 6 min! continuous!!

ilia3101

5D3.113

Unloaded all my modules by editing module.c and recompiling. Anyway.




JPEGRAW

How convenient that I shoot raw photos anyway.

theBilalFakhouri

@ilia3101

Holy Sh!t :o

These 5D3 numbers are coming from video mode, right?

             Shoot memory       SRM memory             Total
JPG        167 MB                     3x39 MB                   284 MB
RAW      243 MB                     5x39 MB                    438 MB ( +54% / +154MB more memory )

So 438 MB of memory will be dedicated for RAW video recording on 5D3 :D --> These will have positive impact when recording at 3K/4K resolutions or higher (more recording time).

ilia3101

Sorry, I am a total idiot!

I must have been in photo mode, because it's only that high before entering live view :(((((

As soon as I enter liveview, the 243 number goes down to 167 :(

When I test now, raw and JPEG produce 100% same exact memory stats, in video liveview. Do you see any possiblity of hacking things  up to increase these numbers?

Both JPEG and raw produce the following same numbers:



Quote from: theBilalFakhouri on June 16, 2022, 02:04:28 PM
So 438 MB of memory will be dedicated for RAW video recording on 5D3 :D --> These will have positive impact when recording at 3K/4K resolutions or higher (more recording time).

Imagine 🤤

theBilalFakhouri

No you are not, no problem.

Quote from: ilia3101 on June 16, 2022, 08:45:30 PM
Do you see any possiblity of hacking things  up to increase these numbers?

I think that depending on which tasks from Canon are allocating shoot memory and SRM buffers, and why they allocate them.
If some of the tasks just allocate memory without using it, it might be there possibility to restore the memory or steal it. needs more digging (I am not memory expert guy :P).

If I were you I will check 1.2.3 firmware if it does something to memory (when selecting JPEG vs RAW). probably testing other higher firmware versions too.



On 700D when image quality set to RAW, and when the camera in photo mode (none LiveView) it's:

-shoot total: 95 MB (same as video mode)
-SRM job total: 4x31 MB (video mode it's 2x31)

So on 700D it's only allocating 2x31 = 62 MB from SRM for LiveView? on 5D3 the number seems higher for LiveView (which takes 76 MB from shoot memory, and 2x39 MB from SRM), beside YUV paths almost have the same resolutions among 700D and 5D3.


-700D: total memory is 256 MB, Canon takes   99 MB (for LiveView and other things), remaining is 157 MB.
-5D3:   total memory is 512 MB, Canon takes 228 MB (for LiveView and other things), remaining is 284 MB.

When allocating from SRM buffers, you can't allocate any size you want, but you can allocate a whole chunk which is 31 MB on 700D, 39 MB on 5D3, but where is the remaining 76 MB from shoot memory on 5D3? (or where it's used?).

(take this with grain of salt, I might be mistaken with some info)



@Levas could you do the test on 6D?

Levas

Hi, tested on the 6d.
JPG only is 151MB + 3 x 35MB in photo mode, RAW only is 255MB + 4 x 35MB in photo mode.
But with RAW only, as soon as I activate live view either in photo or video mode, it's going to 151MB + 3 x 35MB.





Must say that I always had the camera in RAW photo mode only, didn't needed the jpg's.

theBilalFakhouri

Thanks Levas, could you redo the test but only in video mode?

-Unload modules
-Switch camera to video mode (and keep it in video mode while doing the test)
-Set "Image quality" to  RAW, restart camera, see "Free Memory" then write down "shoot total" and "SRM job total"
-Set "Image quality" to JPEG, restart camera, see "Free Memory" then write down "shoot total" and "SRM job total"

Thanks in advance!


2blackbar

On EOS M when i choose jpg
31 config and 55 total , srm 2x31


when i choose RAW then it goes to 20 config and 23 total srm 3x31




canon 5D II:
RAW photo:

config 28mb
total 183mb
srm 6x38mb
when i enable liveview in this mode , it drops srm to 4x38mb

JPEG:
config 32mb
total 259mn
srm 4x38mb
in this mode when i run liveview to get video it drops srm to  2x38, config and total stays the same


Sooo... which one is better to use for raw video ? Isnt it better to spend less memory on photo to get more for raw recording ?

Skinny

5D2 results are the same as @2blackbar's, screens:

jpg:



raw:




And it seems like I saw 4x38 and 259mb with jpeg selected, but I don't know how it happened. I triple-checked it and I was in live view, so it was strange.. and I couldn't reproduce it again.


550D jpg:



raw:


heder

There might be is an additional way of getting a few extra buffers for recording  :o, simply by doing allocation reserved. It seems (?) due to history that the allocating was done firstly using shoot_malloc allocation and the srm_malloc memory allocation. The shoot config allocation allocate memory but each buffer is much smaller than the full size 14 bits buffers (srm_malloc). So basically we're getting much more memory fragmentation than needed. By using the allocation in the reverse order memorhy fragmentation become much smaller, i.e. we have more big buffer and few smaller onces. The optimal case would be to allocate the entire memory as one blob, but I have'nt seen anyone being capable of that(?). The debug memory info is run by guess_free_mem_task which first allocated shoot config and then allocates using srm (the same happens in mlv_lite and mlv_rec). It's possible to do this in the reversed order.

The total ammount of buffer than can be allocated is :

Buffers = ammout_shoot_config_buffer * round_down(shoot_config_buffer_size / (framesize+overhead)) +
         ammout_raw_buffer * round_down(raw_buffer_size / (framesize+overhead))
      
Examples:
On the 40D the srm buffers are 18153360 bytes (width*height*14/8) while the shoot config buffer are only 4194304 bytes (0x400000). Now it'll be clear to anyone that shooting with a frame size of a little more than the half size of the shoot config is a very bad idea, because we waste alot of memory, but it the size is just a little smaller than the 1/8 of the buffers size (or 1/4,1/2,1/1), then it's a really good idea. Bascially it depend on the frame size.

It's just a lot of additional programming for a few buffers ?

Btw. on the 40D I also get an additional srm RAW buffer if I only select "JPEG"
... some text here ..

mlrocks

I tried 14 bit 14 bit lossless UHD 1x3 on 650 D using the ml version the second latest. photo image quality in canon menu set to raw (not raw+jpeg I had before). Overexposure the test scene intentionally to get 85 MB/s, it is about 9 seconds recording time. Debugging memory crushes the camera.

Update:
After unloading all the modules, I could check the memory 95 MB+2x31MB in raw mode.

Walter Schulz

Please specify build used. "Second latest" is not a proper designation!

Overexposure (=sensor data blown out) and losless compression are rumoured to not get along well. What is your intention to verify that?

mlrocks

Quote from: Walter Schulz on July 31, 2022, 08:09:04 PM
Please specify build used. "Second latest" is not a proper designation!

Overexposure (=sensor data blown out) and losless compression are rumoured to not get along well. What is your intention to verify that?

I will update to the latest and retest. :)
I intentionally overexposedthe scene to increase the writing stream to 85 MB/s, normal exposure was 70 MB/s.

mlrocks

Comparing to jpeg+raw, raw seems not improving the recording time. What did I miss, except using the second latest ver?