[Ffmpeg-devel] [PATCH] TIFF encoder (Google SoC qualification task)
Kamil Nowosad
k.nowosad
Wed Apr 4 16:50:23 CEST 2007
Hi
On Wed, Apr 04, 2007 at 02:05:59PM +0200, Michael Niedermayer wrote:
> theres nothing wrong with it, i just dont like it ...
> also i think the related code could be simplified
Done.
--
Best regards,
Kamil Nowosad
-------------- next part --------------
Index: libavcodec/utils.c
===================================================================
--- libavcodec/utils.c (wersja 8627)
+++ libavcodec/utils.c (kopia robocza)
@@ -633,7 +633,7 @@
{"color_table_id", NULL, OFFSET(color_table_id), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
{"internal_buffer_count", NULL, OFFSET(internal_buffer_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
{"global_quality", NULL, OFFSET(global_quality), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"coder", NULL, OFFSET(coder_type), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "coder"},
+{"coder", NULL, OFFSET(coder_type), FF_OPT_TYPE_INT, FF_CODER_TYPE_DEFAULT, INT_MIN, INT_MAX, V|E, "coder"},
{"vlc", "variable length coder / huffman coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_VLC, INT_MIN, INT_MAX, V|E, "coder"},
{"ac", "arithmetic coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_AC, INT_MIN, INT_MAX, V|E, "coder"},
{"raw", "raw (no encoding)", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_RAW, INT_MIN, INT_MAX, V|E, "coder"},
Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h (wersja 8627)
+++ libavcodec/avcodec.h (kopia robocza)
@@ -1566,6 +1566,7 @@
*/
int global_quality;
+#define FF_CODER_TYPE_DEFAULT -1
#define FF_CODER_TYPE_VLC 0
#define FF_CODER_TYPE_AC 1
#define FF_CODER_TYPE_RAW 2
Index: libavcodec/tiffenc.c
===================================================================
--- libavcodec/tiffenc.c (wersja 8627)
+++ libavcodec/tiffenc.c (kopia robocza)
@@ -35,6 +35,12 @@
#define TIFF_MAX_ENTRY 32
+#ifdef CONFIG_ZLIB
+#define TIFF_DEFAULT TIFF_DEFLATE
+#else
+#define TIFF_DEFAULT TIFF_PACKBITS
+#endif
+
/** sizes of various TIFF field types (string size = 1)*/
static const uint8_t type_sizes2[6] = {
0, 1, 1, 2, 4, 8
@@ -192,13 +198,20 @@
p->pict_type = FF_I_TYPE;
p->key_frame = 1;
- s->compr = TIFF_PACKBITS;
- if (avctx->compression_level == 0) {
+ /** set the compression */
+ if (avctx->coder_type == FF_CODER_TYPE_DEFAULT)
+ s->compr = TIFF_DEFAULT;
+ else if (avctx->coder_type == FF_CODER_TYPE_RAW)
s->compr = TIFF_RAW;
+ else if (avctx->coder_type == FF_CODER_TYPE_RLE)
+ s->compr = TIFF_PACKBITS;
#ifdef CONFIG_ZLIB
- } else if ((avctx->compression_level > 2)) {
+ else if (avctx->coder_type == FF_CODER_TYPE_DEFLATE)
s->compr = TIFF_DEFLATE;
#endif
+ else {
+ av_log(avctx, AV_LOG_ERROR, "This compression is not supported\n");
+ return -1;
}
s->width = avctx->width;
More information about the ffmpeg-devel
mailing list