[Bf-committers] Getting Blender ready for 10-Bit video

Sergey Sharybin sergey.vfx at gmail.com
Mon Aug 5 21:48:38 CEST 2013


Hi,

Blender does not support 16bit images, it only supports either 8bit byte
images or 32bit float ones. And FFmpeg does not support 32bit, AFAIR.

So what you'll probably want to do is to configure image_convert_ctx to use
16bit FFmpeg buffer and then in ffmpeg_postprocess you'll need to convert
16bit FFmpeg buffer to ImBuf's float buffer. Also, you'll need 16bit
temporary buffer there to run postprocessing (currently ffmpeg_postprocess
uses buffer from ImBuf) to work with.

So seems what you'll need to do is:

- Add 16bit buffer to Anim structure, which would be used for
postprocessing.
- in start_ffmpeg check on color depth, and configure image_convert_ctx to
either 8but or 16bit output.
- If codec output is 16bit, then you'll allocate Anim's 16bit buffer
- In ffmpeg_postprocess you'll either operate with Anim's 16bit buffer (if
present) or with ImBuf->rect
- You'll need to tweak endian switch code to work properly, tho.
- At the end of this function you would want to do two things:
  * Convert 16bit buffer to ImBuf->rect_float
  * Make sure ImBuf->rect_float is in linear space. For now think this
trick will work:
    IMB_buffer_float_from_float(ibuf->rect_float, ibuf->rect_float,
ibuf->channels, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, TRUE, ibuf->x,
ibuf->y, ibuf->x, ibuf->x);

You would also want to modify write_ffmpeg.c to be able to write higher
depth movies, but let's keep it aside for a while and work on reading first.



On Mon, Aug 5, 2013 at 11:23 AM, Björn Sonnenschein <green at unitybox.de>wrote:

> Hello there,
>
> A new one is coming on board :)
> I am Björn, coming from Germany and the dominating purpose I use blender
> for is video editing and compositing. Regarding this, I have already
> worked on some python scripts, namely the VSE to Compositor and
> Sequencer In and Outpoints ones. At the moment I am learning a little
> c/c++ in my spare time and would like to do something for blender with
> this.
>
> As video with a depth of more than 8 bit might get popular due to
> blackmagic's cameras (My BMPCC will arrive soon, meaning hopefully
> before Christmas ;) ) I am looking into making blender ready for this.
> I have to confess that I am not very familiar with Blender's code and C.
> What I have understood so far is that the img_convert_ctx struct is
> filled in the startffmpeg function in anim_movie.c and
> ffmpeg_postprocess calls sws_scale from ffmpeg which converts the pixel
> format (?).
>
> By now, the frame is converted to RGBA (?), but for some time past
> swscale does also support conversion to RGBA64, so 16 bit per plane
> which I would suggest to use for movies instead.
>
> Unfortunately I was unable to find further documentation of Blender's
> movie decoding pipeline, so I am asking for help about what I have to
> change to get that thing working.
>
> Cheers,
> Björn
>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>



-- 
With best regards, Sergey Sharybin


More information about the Bf-committers mailing list