[FFmpeg-devel] [PATCH]Add frame-threading capability to some encoders

Carl Eugen Hoyos cehoyos at ag.or.at
Sat May 31 10:01:12 CEST 2014


Hi!

Attached patches allow a >50% speedup here when encoding to utvideo, tiff, 
ljpeg, jpegls and lcl.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index e602d6a..0a96fed 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -642,6 +642,7 @@ AVCodec ff_utvideo_encoder = {
     .init           = utvideo_encode_init,
     .encode2        = utvideo_encode_frame,
     .close          = utvideo_encode_close,
+    .capabilities   = CODEC_CAP_FRAME_THREADS | CODEC_CAP_INTRA_ONLY,
     .pix_fmts       = (const enum AVPixelFormat[]) {
                           AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_YUV422P,
                           AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE
-------------- next part --------------
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 456b3bf..dba4ffe 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -545,6 +545,7 @@ AVCodec ff_tiff_encoder = {
     .priv_data_size = sizeof(TiffEncoderContext),
     .init           = encode_init,
     .close          = encode_close,
+    .capabilities   = CODEC_CAP_FRAME_THREADS | CODEC_CAP_INTRA_ONLY,
     .encode2        = encode_frame,
     .pix_fmts       = (const enum AVPixelFormat[]) {
         AV_PIX_FMT_RGB24, AV_PIX_FMT_PAL8, AV_PIX_FMT_GRAY8,
-------------- next part --------------
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index 6fd86ff..9b9f5dc 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -319,6 +319,7 @@ AVCodec ff_ljpeg_encoder = {
     .init           = ljpeg_encode_init,
     .encode2        = ljpeg_encode_frame,
     .close          = ljpeg_encode_close,
+    .capabilities   = CODEC_CAP_FRAME_THREADS | CODEC_CAP_INTRA_ONLY,
     .pix_fmts       = (const enum AVPixelFormat[]){
         AV_PIX_FMT_BGR24   , AV_PIX_FMT_BGRA    , AV_PIX_FMT_BGR0,
         AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P,
-------------- next part --------------
diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c
index 0afe553..201d357 100644
--- a/libavcodec/lclenc.c
+++ b/libavcodec/lclenc.c
@@ -197,5 +197,6 @@ AVCodec ff_zlib_encoder = {
     .init           = encode_init,
     .encode2        = encode_frame,
     .close          = encode_end,
+    .capabilities   = CODEC_CAP_FRAME_THREADS | CODEC_CAP_INTRA_ONLY,
     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE },
 };
-------------- next part --------------
diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c
index 030178f..2f02332 100644
--- a/libavcodec/jpeglsenc.c
+++ b/libavcodec/jpeglsenc.c
@@ -431,6 +431,7 @@ AVCodec ff_jpegls_encoder = {
     .id             = AV_CODEC_ID_JPEGLS,
     .init           = encode_init_ls,
     .close          = encode_close,
+    .capabilities   = CODEC_CAP_FRAME_THREADS | CODEC_CAP_INTRA_ONLY,
     .encode2        = encode_picture_ls,
     .pix_fmts       = (const enum AVPixelFormat[]) {
         AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB24,


More information about the ffmpeg-devel mailing list