Re: [FFmpeg-devel] [PATCH 1/1] Add support for Ericsson Texture Compression 1 (ETC1)

2017-02-27 Thread Paul B Mahol
On 2/22/17, Paul B Mahol  wrote:
> On 2/22/17, Devin Heitmueller  wrote:
>> This patch adds support for encoding/decoding ETC1 compressed
>> textures.  This includes support for the PKM file format.
>>
>> Example usage:
>>
>> ./ffmpeg -i input_image.jpg new.pkm
>> ./ffmpeg -i new.pkm foo.jpg
>>
>> Signed-off-by: Devin Heitmueller 
>> ---
>>  libavcodec/Makefile |   2 +
>>  libavcodec/allcodecs.c  |   1 +
>>  libavcodec/avcodec.h|   1 +
>>  libavcodec/codec_desc.c |   7 +
>>  libavcodec/etc1.c   | 707
>> 
>>  libavcodec/etc1.h   | 114 
>>  libavcodec/etc1dec.c|  81 ++
>>  libavcodec/etc1enc.c|  90 ++
>>  libavcodec/utils.c  |   3 +-
>>  libavformat/img2.c  |   1 +
>>  libavformat/img2enc.c   |   2 +-
>>  11 files changed, 1007 insertions(+), 2 deletions(-)
>>  create mode 100644 libavcodec/etc1.c
>>  create mode 100644 libavcodec/etc1.h
>>  create mode 100644 libavcodec/etc1dec.c
>>  create mode 100644 libavcodec/etc1enc.c
>>
>
> Apache 2.0 license is bad in combination with LGPL.
>

Also I think this could make use of texturedsp if possible.

So better reimplement as LGPL from scratch.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/1] Add support for Ericsson Texture Compression 1 (ETC1)

2017-02-22 Thread Paul B Mahol
On 2/22/17, Devin Heitmueller  wrote:
> This patch adds support for encoding/decoding ETC1 compressed
> textures.  This includes support for the PKM file format.
>
> Example usage:
>
> ./ffmpeg -i input_image.jpg new.pkm
> ./ffmpeg -i new.pkm foo.jpg
>
> Signed-off-by: Devin Heitmueller 
> ---
>  libavcodec/Makefile |   2 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h|   1 +
>  libavcodec/codec_desc.c |   7 +
>  libavcodec/etc1.c   | 707
> 
>  libavcodec/etc1.h   | 114 
>  libavcodec/etc1dec.c|  81 ++
>  libavcodec/etc1enc.c|  90 ++
>  libavcodec/utils.c  |   3 +-
>  libavformat/img2.c  |   1 +
>  libavformat/img2enc.c   |   2 +-
>  11 files changed, 1007 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/etc1.c
>  create mode 100644 libavcodec/etc1.h
>  create mode 100644 libavcodec/etc1dec.c
>  create mode 100644 libavcodec/etc1enc.c
>

Apache 2.0 license is bad in combination with LGPL.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/1] Add support for Ericsson Texture Compression 1 (ETC1)

2017-02-22 Thread Devin Heitmueller
This patch adds support for encoding/decoding ETC1 compressed
textures.  This includes support for the PKM file format.

Example usage:

./ffmpeg -i input_image.jpg new.pkm
./ffmpeg -i new.pkm foo.jpg

Signed-off-by: Devin Heitmueller 
---
 libavcodec/Makefile |   2 +
 libavcodec/allcodecs.c  |   1 +
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   7 +
 libavcodec/etc1.c   | 707 
 libavcodec/etc1.h   | 114 
 libavcodec/etc1dec.c|  81 ++
 libavcodec/etc1enc.c|  90 ++
 libavcodec/utils.c  |   3 +-
 libavformat/img2.c  |   1 +
 libavformat/img2enc.c   |   2 +-
 11 files changed, 1007 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/etc1.c
 create mode 100644 libavcodec/etc1.h
 create mode 100644 libavcodec/etc1dec.c
 create mode 100644 libavcodec/etc1enc.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a1ce264..f5eec15 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -280,6 +280,8 @@ OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER)+= 8svx.o
 OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER)+= 8svx.o
 OBJS-$(CONFIG_ESCAPE124_DECODER)   += escape124.o
 OBJS-$(CONFIG_ESCAPE130_DECODER)   += escape130.o
+OBJS-$(CONFIG_ETC1_ENCODER)+= etc1enc.o etc1.o
+OBJS-$(CONFIG_ETC1_DECODER)+= etc1dec.o etc1.o
 OBJS-$(CONFIG_EVRC_DECODER)+= evrcdec.o acelp_vectors.o lsp.o
 OBJS-$(CONFIG_EXR_DECODER) += exr.o
 OBJS-$(CONFIG_FFV1_DECODER)+= ffv1dec.o ffv1.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index f12a54d..cd3a662 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -184,6 +184,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(EIGHTSVX_FIB,  eightsvx_fib);
 REGISTER_DECODER(ESCAPE124, escape124);
 REGISTER_DECODER(ESCAPE130, escape130);
+REGISTER_ENCDEC (ETC1,  etc1);
 REGISTER_DECODER(EXR,   exr);
 REGISTER_ENCDEC (FFV1,  ffv1);
 REGISTER_ENCDEC (FFVHUFF,   ffvhuff);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5616fb0..bf86210 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -388,6 +388,7 @@ enum AVCodecID {
 AV_CODEC_ID_DXV,
 AV_CODEC_ID_SCREENPRESSO,
 AV_CODEC_ID_RSCC,
+AV_CODEC_ID_ETC1,
 
 AV_CODEC_ID_Y41P = 0x8000,
 AV_CODEC_ID_AVRP,
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 35846c0..de7695d 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1199,6 +1199,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 },
 
 {
+.id= AV_CODEC_ID_ETC1,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "etc1",
+.long_name = NULL_IF_CONFIG_SMALL("ETC1 (Ericsson Texture Compression) 
image"),
+.props = AV_CODEC_PROP_LOSSY,
+},
+{
 .id= AV_CODEC_ID_G2M,
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "g2m",
diff --git a/libavcodec/etc1.c b/libavcodec/etc1.c
new file mode 100644
index 000..e28d83c
--- /dev/null
+++ b/libavcodec/etc1.c
@@ -0,0 +1,707 @@
+// Copyright 2009 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//
+
+// This is a fork of the AOSP project ETC1 codec. The original code can be 
found
+// at the following web site:
+// 
https://android.googlesource.com/platform/frameworks/native/+/master/opengl/include/ETC1/
+
+//
+
+#include "etc1.h"
+
+//#include 
+#include 
+
+/* From 
http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
+
+ The number of bits that represent a 4x4 texel block is 64 bits if
+  is given by ETC1_RGB8_OES.
+
+ The data for a block is a number of bytes,
+
+ {q0, q1, q2, q3, q4, q5, q6, q7}
+
+ where byte q0 is located at the lowest memory address and q7 at
+ the highest. The 64 bits specifying the block is then represented
+ by the following 64 bit integer:
+
+ int64bit = 256*(256*(256*(256*(256*(256*(256*q0+q1)+q2)+q3)+q4)+q5)+q6)+q7;
+
+ ETC1_RGB8_OES:
+
+ a) bit layout in bits 63 through 32 if diffbit = 0
+
+ 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
+