Browse code

Introduce slice threads flag.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>

Ronald S. Bultje authored on 2011/04/21 03:14:42
Showing 12 changed files
... ...
@@ -13,6 +13,9 @@ libavutil:   2011-04-18
13 13
 
14 14
 API changes, most recent first:
15 15
 
16
+2011-04-21 - XXXXXX - lavc 53.1.0 - avcodec.h
17
+  Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading.
18
+
16 19
 2011-04-15 - lavc 52.120.0 - avcodec.h
17 20
   AVPacket structure got additional members for passing side information:
18 21
     4de339e introduce side information for AVPacket
... ...
@@ -676,6 +676,10 @@ typedef struct RcOverride{
676 676
  * Codec supports frame-level multithreading.
677 677
  */
678 678
 #define CODEC_CAP_FRAME_THREADS    0x1000
679
+/**
680
+ * Codec supports slice-based (or partition-based) multithreading.
681
+ */
682
+#define CODEC_CAP_SLICE_THREADS    0x2000
679 683
 
680 684
 //The following defines may change, don't expect compatibility if you use them.
681 685
 #define MB_TYPE_INTRA4x4   0x0001
... ...
@@ -869,6 +869,7 @@ AVCodec ff_dnxhd_encoder = {
869 869
     dnxhd_encode_init,
870 870
     dnxhd_encode_picture,
871 871
     dnxhd_encode_end,
872
+    .capabilities = CODEC_CAP_SLICE_THREADS,
872 873
     .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE},
873 874
     .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
874 875
     .priv_class = &class,
... ...
@@ -1297,6 +1297,7 @@ AVCodec ff_dvvideo_encoder = {
1297 1297
     sizeof(DVVideoContext),
1298 1298
     dvvideo_init_encoder,
1299 1299
     dvvideo_encode_frame,
1300
+    .capabilities = CODEC_CAP_SLICE_THREADS,
1300 1301
     .pix_fmts  = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE},
1301 1302
     .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
1302 1303
 };
... ...
@@ -1312,7 +1313,7 @@ AVCodec ff_dvvideo_decoder = {
1312 1312
     NULL,
1313 1313
     dvvideo_close,
1314 1314
     dvvideo_decode_frame,
1315
-    CODEC_CAP_DR1,
1315
+    CODEC_CAP_DR1 | CODEC_CAP_SLICE_THREADS,
1316 1316
     NULL,
1317 1317
     .max_lowres = 3,
1318 1318
     .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
... ...
@@ -1795,7 +1795,7 @@ AVCodec ff_ffv1_decoder = {
1795 1795
     NULL,
1796 1796
     common_end,
1797 1797
     decode_frame,
1798
-    CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
1798
+    CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/ | CODEC_CAP_SLICE_THREADS,
1799 1799
     NULL,
1800 1800
     .long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
1801 1801
 };
... ...
@@ -1809,6 +1809,7 @@ AVCodec ff_ffv1_encoder = {
1809 1809
     encode_init,
1810 1810
     encode_frame,
1811 1811
     common_end,
1812
+    .capabilities = CODEC_CAP_SLICE_THREADS,
1812 1813
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_NONE},
1813 1814
     .long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
1814 1815
 };
... ...
@@ -3426,7 +3426,8 @@ AVCodec ff_h264_decoder = {
3426 3426
     NULL,
3427 3427
     ff_h264_decode_end,
3428 3428
     decode_frame,
3429
-    /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY,
3429
+    /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY |
3430
+        CODEC_CAP_SLICE_THREADS,
3430 3431
     .flush= flush_dpb,
3431 3432
     .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
3432 3433
     .profiles = NULL_IF_CONFIG_SMALL(profiles),
... ...
@@ -2523,7 +2523,7 @@ AVCodec ff_mpeg2video_decoder = {
2523 2523
     NULL,
2524 2524
     mpeg_decode_end,
2525 2525
     mpeg_decode_frame,
2526
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
2526
+    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
2527 2527
     .flush= flush,
2528 2528
     .max_lowres= 3,
2529 2529
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
... ...
@@ -2540,7 +2540,7 @@ AVCodec ff_mpegvideo_decoder = {
2540 2540
     NULL,
2541 2541
     mpeg_decode_end,
2542 2542
     mpeg_decode_frame,
2543
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
2543
+    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
2544 2544
     .flush= flush,
2545 2545
     .max_lowres= 3,
2546 2546
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
... ...
@@ -940,7 +940,7 @@ AVCodec ff_mpeg1video_encoder = {
940 940
     MPV_encode_end,
941 941
     .supported_framerates= ff_frame_rate_tab+1,
942 942
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
943
-    .capabilities= CODEC_CAP_DELAY,
943
+    .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
944 944
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
945 945
 };
946 946
 
... ...
@@ -954,6 +954,6 @@ AVCodec ff_mpeg2video_encoder = {
954 954
     MPV_encode_end,
955 955
     .supported_framerates= ff_frame_rate_tab+1,
956 956
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE},
957
-    .capabilities= CODEC_CAP_DELAY,
957
+    .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
958 958
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
959 959
 };
... ...
@@ -1347,6 +1347,6 @@ AVCodec ff_mpeg4_encoder = {
1347 1347
     MPV_encode_picture,
1348 1348
     MPV_encode_end,
1349 1349
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
1350
-    .capabilities= CODEC_CAP_DELAY,
1350
+    .capabilities= CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
1351 1351
     .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
1352 1352
 };
... ...
@@ -3800,6 +3800,7 @@ AVCodec ff_h263p_encoder = {
3800 3800
     MPV_encode_init,
3801 3801
     MPV_encode_picture,
3802 3802
     MPV_encode_end,
3803
+    .capabilities = CODEC_CAP_SLICE_THREADS,
3803 3804
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
3804 3805
     .long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"),
3805 3806
 };
... ...
@@ -877,7 +877,8 @@ static void validate_thread_parameters(AVCodecContext *avctx)
877 877
         avctx->active_thread_type = 0;
878 878
     } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) {
879 879
         avctx->active_thread_type = FF_THREAD_FRAME;
880
-    } else if (avctx->thread_type & FF_THREAD_SLICE) {
880
+    } else if (avctx->codec->capabilities & CODEC_CAP_SLICE_THREADS &&
881
+               avctx->thread_type & FF_THREAD_SLICE) {
881 882
         avctx->active_thread_type = FF_THREAD_SLICE;
882 883
     }
883 884
 }
... ...
@@ -21,7 +21,7 @@
21 21
 #define AVCODEC_VERSION_H
22 22
 
23 23
 #define LIBAVCODEC_VERSION_MAJOR 53
24
-#define LIBAVCODEC_VERSION_MINOR  0
24
+#define LIBAVCODEC_VERSION_MINOR  1
25 25
 #define LIBAVCODEC_VERSION_MICRO  0
26 26
 
27 27
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \