dcv icon indicating copy to clipboard operation
dcv copied to clipboard

Image I/O

Open ljubobratovicrelja opened this issue 8 years ago • 5 comments

As discussed in #48, maybe we should start planning on how to enrich the image I/O package of the library. Imageformats library is good (especially because it is purely written in D), but format coverage is poor (especially for encoders).

Use C libraries

So first idea is to build minimal bindings (or use existing ones) to popular C libraries:

Pros:

  • industry-wide used and tested libraries
  • minimal pain for maximal gain :)

Cons:

  • more C dependencies

Translate libraries to D

Some people already translated some of the popular encoder/decoders to D. I feel that's not that easy to do, and I'd personally much more like to focus on the DCV's core, but if we decide to take this step, no problem.

Using FFmpeg

@henrygouk suggested we could use ffmpeg to encode/decode image formats. This also seems like a great choice since lot of formats are supported, and ffmpeg-d is already a dependency.

Custom image I/O library's synergy with dcv:core

There was also discussion that users should be free to use 3rd party libraries for image I/O with DCV. I believe this is already achievable in DCV - e.g. if user is working with gtkd, and dcv:core, he/she can load pixbuf from file, then slice it's data and work along with dcv algorithms. So, I believe we're OK here, except maybe we should make an example on this topic to show it to people.

Separation of Image I/O from Video

Also we discussed if image io should be separated from video - in #48 we defined dcv:io sub-package, where we could have defined dcv:ioimage, and dcv:iovideo. If we decide to go with first option (bind C libs), I really think we should do this since it would be heavy loaded with C libs.

Any comment is welcome.

ljubobratovicrelja avatar Sep 19 '16 19:09 ljubobratovicrelja

Pinging guys working on DCV @DmitryOlshansky @9il @henrygouk

ljubobratovicrelja avatar Sep 19 '16 19:09 ljubobratovicrelja

It looks like ffmpeg supports all of those image formats [1], which could cut down on the amount of work required. It's also already a dependency for the video IO, so no new dependencies would need to be added.

henrygouk avatar Sep 20 '16 01:09 henrygouk

It looks like ffmpeg supports all of those image formats

Aw, snap - I'm sorry, forgot to add that one! Added to original post.

This actually sounds like a great plan! Relatively easy to implement, and truly powerful - whole lot of formats are supported there. Have you had any experience with this pipeline? Are there any potential drawbacks? I'd suppose there are none or very few...

ljubobratovicrelja avatar Sep 20 '16 04:09 ljubobratovicrelja

I've never worked with the ffmpeg libraries before, so I'm not sure how easy it would be to use them. It looks like the ff_load_image function will come in handy, though saving images may be a bit more involved.

henrygouk avatar Sep 20 '16 05:09 henrygouk

We'll figure it out - ffmpeg tool has options to load image sequence and save them as video file, and vice versa, so there's a way to do this for sure.

ljubobratovicrelja avatar Sep 20 '16 07:09 ljubobratovicrelja