[FFmpeg-cvslog] h264: Replace mpegvideo-specific MAX_THREADS by private define

Vittorio Giovara git at videolan.org
Mon Mar 17 06:23:09 CET 2014


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Fri Feb 28 13:21:59 2014 +0100| [e3c2d0f3d41f79f7be7ba944aaca2e287c7d5c7c] | committer: Vittorio Giovara

h264: Replace mpegvideo-specific MAX_THREADS by private define

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3c2d0f3d41f79f7be7ba944aaca2e287c7d5c7c
---

 libavcodec/h264.c |    8 ++++----
 libavcodec/h264.h |    3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index d78cdb8..99f8f14 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1195,7 +1195,7 @@ static void free_tables(H264Context *h, int free_rbsp)
 
     h->cur_pic_ptr = NULL;
 
-    for (i = 0; i < MAX_THREADS; i++) {
+    for (i = 0; i < H264_MAX_THREADS; i++) {
         hx = h->thread_context[i];
         if (!hx)
             continue;
@@ -3224,12 +3224,12 @@ static int h264_slice_header_init(H264Context *h, int reinit)
         return ret;
     }
 
-    if (nb_slices > MAX_THREADS || (nb_slices > h->mb_height && h->mb_height)) {
+    if (nb_slices > H264_MAX_THREADS || (nb_slices > h->mb_height && h->mb_height)) {
         int max_slices;
         if (h->mb_height)
-            max_slices = FFMIN(MAX_THREADS, h->mb_height);
+            max_slices = FFMIN(H264_MAX_THREADS, h->mb_height);
         else
-            max_slices = MAX_THREADS;
+            max_slices = H264_MAX_THREADS;
         av_log(h->avctx, AV_LOG_WARNING, "too many threads/slices %d,"
                " reducing to %d\n", nb_slices, max_slices);
         nb_slices = max_slices;
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index f31a070..b442106 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -40,6 +40,7 @@
 #include "rectangle.h"
 
 #define H264_MAX_PICTURE_COUNT 32
+#define H264_MAX_THREADS       16
 
 #define MAX_SPS_COUNT          32
 #define MAX_PPS_COUNT         256
@@ -580,7 +581,7 @@ typedef struct H264Context {
      * @name Members for slice based multithreading
      * @{
      */
-    struct H264Context *thread_context[MAX_THREADS];
+    struct H264Context *thread_context[H264_MAX_THREADS];
 
     /**
      * current slice number, used to initalize slice_num of each thread/context



More information about the ffmpeg-cvslog mailing list