facebook / fresco

An Android library for managing images and the memory they use.
https://frescolib.org/
MIT License
17.05k stars 3.75k forks source link

Decode BPG images #810

Closed ioana-bacila closed 6 years ago

ioana-bacila commented 8 years ago

Hello,

I am a developer in search of an open source project trying to add some contributions in order to grow her own coding skills. I am interested in mainly Java and Android tools. After searching the Internet I found your library which is quite nice. I studied during my master degree about image encoding and formats. I realized that fresco doesn't add support for BPG, but it does add support for WebP. I consider that it would be quite a nice feature to be added to fresco, even though BPG (later edit - typo) is a fresh format. I have seen the comparisons between other graphics encoding and it seems that is does make a difference. Fresco would be up to date with the latest cutting edge technologies. If you think it is okay to include such support to fresco, I would gladly like to implement it.

Best regards, Ioana

plamenko commented 8 years ago

Hi!

Thank you for your interest in Fresco. I think your idea is pretty cool and I see no reason not to do it. We just need to check some technicalities such as the license of those image formats, because some of them might be proprietary. On a related note, right now we are in the process of making WebP support optional so that we don't impose additional size overhead to those apps that do not need it. Once we add ability to make WebP optional, I think it would be pretty straightforward to optionally support any other image format at no cost to those that are not using it. So we should be fine on that front too. Btw, I am slightly confused because you mentioned BPG at first and then BNP. Are those two the same image format or? Also, I am curious what you have in mind when you say adding support for it. Do you mean adding an open source C library that handles those formats and the corresponding Java glue-logic, or are you thinking of actually implementing the codec itself?

ioana-bacila commented 8 years ago

Hi again!

First of all: sorry for that typo, it is about BPG image format. I found the codec library of BPG written in C. I believe that it would be much better to use that instead of me implementing again what already exists. Afterwards I will add the Java logic. About WebP: can I help you with that or it is already in progress?

Best Regards, Ioana

plamenko commented 8 years ago

Exactly my thoughts, we should not reimplement this logic, but use the existing implementation. WebP refactoring is already in progress and we should be able to reuse that infrastructure to other formats as well. But waiting until this is done that doesn't have to block you. You can still check out Fresco repo and start playing with it.

ioana-bacila commented 8 years ago

I will not wait for that, I just thought that it is okay to offer my help. I am already working on the task.

ioana-bacila commented 8 years ago

Hello, me again!

I started wondering about the license for the BPG image format. I found out that it is subordinated to HAVC patents license. Here is the list of those who are allowed to use HAVC:

Apple Inc. Electronics and Telecommunications Research Institute (ETRI) Fujitsu Limited Hitachi Maxell, Ltd. HUMAX Holdings Co., Ltd. Intellectual Discovery Co., LTD. JVC KENWOOD Corporation Korea Advanced Institute of Science and Technology (KAIST) Korean Broadcasting System (KBS) KT Corp. M&K Holdings Inc. NEC Corporation Newratek, Inc. Nippon Hoso Kyokai (NHK) Nippon Telegraph and Telephone Corporation (NTT) NTT DOCOMO, INC. Orange SA Samsung Electronics Co., Ltd. Siemens Corp. SK Telecom Tagivan II, LLC The Trustees of Columbia University in the City of New York Vidyo, Inc.

So, I see that not all Android users might be allowed to use such image format. This will have to be notified in the license agreement if someone would like to use the BPG in commercial use. Is this desirable?

Best regards, Ioana

plamenko commented 8 years ago

Let me check that and we will respond here.

ioana-bacila commented 8 years ago

I checked the HAVEC info and BPG licence. There are some restrictions in using the code, but not all is restricted to be included in other projects. They state on their official site that:

  1. "The BPG decoding library excluding the FFmpeg code is released under the BSD license."
  2. "The BPG encoder sources excluding x265 are released under the BSD license."
  3. "Some of the HEVC algorithms may be protected by patents in some countries (read the FFmpeg Patent Mini-FAQ for more information). Most devices already include or will include hardware HEVC support, so we suggest to use it if patents are an issue."

So, I can implement the Java logic using their library to decode BPG.

ioana-bacila commented 8 years ago

Hello and Happy new year,

I have an issue with my contribution: I try to build my code with ndk-build but somehow, I do not know why, I get compile errors. My make file compiles properly with no issues. Can you advise me please about where I should place my libbpg decoder so it could find my functions and compile properly?

Have a nice day and thank you in advance, Ioana

tyronen commented 8 years ago

Use as a model the native code that does transcoding and resizing in the imagepipeline package.

kirwan commented 6 years ago

We're cleaning up long-untouched issues so I'm closing this one.

If you think this is still worth pursuing, feel free to comment and we can re-open. It looks to me as though the licensing issues which have been raised might make this impossible to pursue though.