libx264: Allow overriding the sliced threads option

Message ID 1330979180-11554-1-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö March 5, 2012, 8:26 p.m.
---
 libavcodec/libx264.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Paul B Mahol March 5, 2012, 8:52 p.m. | #1
On 3/5/12, Martin Storsjoe <martin@martin.st> wrote:
> ---
>  libavcodec/libx264.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>

What is point of thread_type then?
Martin Storsjö March 5, 2012, 8:56 p.m. | #2
On Mon, 5 Mar 2012, Paul B Mahol wrote:

> On 3/5/12, Martin Storsjoe <martin@martin.st> wrote:
>> ---
>>  libavcodec/libx264.c |    4 ++++
>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>
>
> What is point of thread_type then?

Hmm, I'll have a look to see if that can be hooked up instead.

// Martin

Patch

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 3934627..e4fee41 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -66,6 +66,7 @@  typedef struct X264Context {
     char *partitions;
     int direct_pred;
     int slice_max_size;
+    int sliced_threads;
 } X264Context;
 
 static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -359,6 +360,8 @@  static av_cold int X264_init(AVCodecContext *avctx)
 
     if (x4->slice_max_size >= 0)
         x4->params.i_slice_max_size =  x4->slice_max_size;
+    if (x4->sliced_threads >= 0)
+        x4->params.b_sliced_threads =  x4->sliced_threads;
 
     if (x4->fastfirstpass)
         x264_param_apply_fastfirstpass(&x4->params);
@@ -505,6 +508,7 @@  static const AVOption options[] = {
     { "temporal",      NULL,      0,    AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" },
     { "auto",          NULL,      0,    AV_OPT_TYPE_CONST, { X264_DIRECT_PRED_AUTO },     0, 0, VE, "direct-pred" },
     { "slice-max-size","Constant quantization parameter rate control method",OFFSET(slice_max_size),        AV_OPT_TYPE_INT,    {-1 }, -1, INT_MAX, VE },
+    { "sliced-threads","Sliced threads instead of frame threads",         OFFSET(sliced_threads),AV_OPT_TYPE_INT,    {-1 }, -1, 1, VE },
     { NULL },
 };