Re: [libav-devel] [PATCH] [RFC] Add Cinepak encoder

2017-07-04 Thread Vittorio Giovara
On Tue, Jul 4, 2017 at 11:59 AM, Diego Biurrun  wrote:
> From: Tomas Härdin 
>
> Signed-off-by: Diego Biurrun 
> ---
>
> The whole set squashed together, to ease Luca's review.

IMO that's also how the set should be squashed and pushed, with a
clear commit message about who changed what.
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] [RFC] Add Cinepak encoder

2017-07-04 Thread Diego Biurrun
From: Tomas Härdin 

Signed-off-by: Diego Biurrun 
---

The whole set squashed together, to ease Luca's review.

 Changelog|1 +
 doc/general.texi |2 +-
 libavcodec/Makefile  |1 +
 libavcodec/allcodecs.c   |2 +-
 libavcodec/cinepakenc.c  | 1238 ++
 tests/fate/vcodec.mak|4 +
 tests/ref/vsynth/vsynth1-cinepak |4 +
 tests/ref/vsynth/vsynth2-cinepak |4 +
 8 files changed, 1254 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/cinepakenc.c
 create mode 100644 tests/ref/vsynth/vsynth1-cinepak
 create mode 100644 tests/ref/vsynth/vsynth2-cinepak

diff --git a/Changelog b/Changelog
index e44df54..adcca3f 100644
--- a/Changelog
+++ b/Changelog
@@ -16,6 +16,7 @@ version :
 - FM Screen Capture Codec decoder
 - ClearVideo decoder (I-frames only)
 - support for decoding through D3D11VA in avconv
+- Cinepak encoder
 
 
 version 12:
diff --git a/doc/general.texi b/doc/general.texi
index 905e2d1..adf5b4e 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -631,7 +631,7 @@ following image formats are supported:
 @tab Codec used in Delphine Software International games.
 @item Discworld II BMV Video @tab @tab  X
 @item Canopus Lossless Codec @tab @tab  X
-@item Cinepak@tab @tab  X
+@item Cinepak@tab  X  @tab  X
 @item Cirrus Logic AccuPak   @tab  X  @tab  X
 @tab fourcc: CLJR
 @item Creative YUV (CYUV)@tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 240f7d8..2b91588 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -186,6 +186,7 @@ OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
 OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
 OBJS-$(CONFIG_CFHD_DECODER)+= cfhd.o cfhddata.o
 OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
+OBJS-$(CONFIG_CINEPAK_ENCODER) += cinepakenc.o
 OBJS-$(CONFIG_CLEARVIDEO_DECODER)  += clearvideo.o
 OBJS-$(CONFIG_CLJR_DECODER)+= cljrdec.o
 OBJS-$(CONFIG_CLJR_ENCODER)+= cljrenc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 70c35e9..5635ae1 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -133,7 +133,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(CDGRAPHICS,cdgraphics);
 REGISTER_DECODER(CDXL,  cdxl);
 REGISTER_DECODER(CFHD,  cfhd);
-REGISTER_DECODER(CINEPAK,   cinepak);
+REGISTER_ENCDEC (CINEPAK,   cinepak);
 REGISTER_DECODER(CLEARVIDEO,clearvideo);
 REGISTER_ENCDEC (CLJR,  cljr);
 REGISTER_DECODER(CLLC,  cllc);
diff --git a/libavcodec/cinepakenc.c b/libavcodec/cinepakenc.c
new file mode 100644
index 000..5466a1e
--- /dev/null
+++ b/libavcodec/cinepakenc.c
@@ -0,0 +1,1238 @@
+/*
+ * Cinepak encoder (c) 2011 Tomas Härdin
+ * http://titan.codemill.se/~tomhar/cinepakenc.patch
+ *
+ * Fixes and improvements, vintage decoders compatibility
+ *  (c) 2013, 2014 Rl, Aetey Global Technologies AB
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/* MAYBE:
+ * - "optimally" split the frame into several non-regular areas
+ *   using a separate codebook pair for each area and approximating
+ *   the area by several rectangular strips (generally not full width ones)
+ *   (use quadtree splitting? a simple fixed-granularity grid?)
+ *
+ *
+ * version 2014-01-23 Rl
+ * - added option handling for flexibility
+ *
+ * version 2014-01-21 Rl
+ * - believe it or not, now we get even smaller files, with better quality
+ *   (which means I missed an optimization earlier :)
+ *
+ * version 2014-01-20 Rl
+ * - made the encoder compatible with vintage decoders
+ *   and added some yet unused code for possible future
+ *   incremental codebook updates
+ * - fixed a small memory leak
+ *
+ * version