From patchwork Sat Aug 1 11:22:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 21425 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 7B95B44A990 for ; Sat, 1 Aug 2020 15:15:03 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5609468B9C6; Sat, 1 Aug 2020 15:15:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0FA5768B9BB for ; Sat, 1 Aug 2020 15:14:57 +0300 (EEST) Received: by mail-io1-f65.google.com with SMTP id s189so26989665iod.2 for ; Sat, 01 Aug 2020 05:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a/Yeh3g0Dob/gE3rY8f9ou4+wr+RWFkozt3E0w6QAno=; b=hkC+lcej1PZEa/JRIb4Bu/99dJwgA/hJDwzakkxP7gOGBg5vx9Xk+CZYFlAZGa1lOt UIDBnw98bnub0cUkOETqT+5Zv6Un4eze2rGaIPNMXf/UFjBQMzpjzJvXYhL8RKm/Y7SF kRXpsoOtdLMkueus95+BMMj/wGFsDszxp7euIDkIX8NYG8JGB5qKf97/RSpYX/fHkOmT Cr7OAKRQgMAylMbmdv2x2op8CT2sTocgu5JIC9+sRTlDu0nYXgjjCtrORKW02kZ9YuS/ WTJ+m8X1ZPD5lhnv3e8VpbAABRqlIjzYqLJY8CVKFt8whOZSs4P8Bbarm2V8DOWOtWyG 812w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a/Yeh3g0Dob/gE3rY8f9ou4+wr+RWFkozt3E0w6QAno=; b=NsQEa2F7iP14fBAPss6A6ma1WTdwZ0k9jLc+5Plzl6ko5Pjkst+9rMNN9Zf2mP4eHM 7WcBOIQN3A4yCQDrs10i58uhQ3qwrBJVIJ/S8Ec0a1SPLNQ8yMXEu5DQgsL18mnWgApY Hd659+i8G2xqw/PuZQccYsnsvaMXzx5JGSwIEJ+LMj+h2K9jwML4B2sDtFH8OHRKJIMq 1uo1WyDqPLpcntE5DUWFyvNM9igp/ksvPDnXZacOCUJVLLVhl4HaUBsvD7PcShBixFQk 9LIoCm+5QPhU1+VunHAoy3YLPcbukFEwrDY2lVB6D6YnCFrs+tNXKTFdPgjNWGKBxHW8 d05w== X-Gm-Message-State: AOAM530RK/z2foN6FlJu5XFL27WYS3VyDKkpUZaVnd5cYZuAipUlia5I 67UK3DTLaxxUG/DRjELdTykpWas8 X-Google-Smtp-Source: ABdhPJxngWR3u4El47YIUb2EhoP1PE87X/amPiOEDEqYUq8QqXYMl1LjtwCRn7CMgXbh3nF3E2hr9g== X-Received: by 2002:a63:395:: with SMTP id 143mr7608581pgd.57.1596280989275; Sat, 01 Aug 2020 04:23:09 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id 21sm13046925pfa.4.2020.08.01.04.23.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Aug 2020 04:23:08 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sat, 1 Aug 2020 19:22:42 +0800 Message-Id: <1596280963-15526-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1596280963-15526-1-git-send-email-lance.lmwang@gmail.com> References: <1596280963-15526-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/libsvtav1: support cores and socket options for svt av1 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- doc/encoders.texi | 9 +++++++++ libavcodec/libsvtav1.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 2f5457f..da0b68d 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1747,6 +1747,15 @@ Set log2 of the number of rows of tiles to use (0-6). @item tile_columns Set log2 of the number of columns of tiles to use (0-4). +@item cores +Set the number of logical processor which encoder threads run on. Default is: 0 +which is unset. If cores and socket are not set, threads are managed by OS thread +scheduler. + +@item socket +Set which target socket to run on. For multiple socket systems, this can specify which +socket the encoder runs on. Default is: -1 which is unset. + @end table @section libkvazaar diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index 3e3b907..78e0ee5 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -71,6 +71,9 @@ typedef struct SvtContext { int tile_columns; int tile_rows; + + int cores; + int socket; } SvtContext; static const struct { @@ -204,6 +207,10 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param, param->tile_columns = svt_enc->tile_columns; param->tile_rows = svt_enc->tile_rows; + if (svt_enc->cores > 0) + param->logical_processors = svt_enc->cores; + if (svt_enc->socket >= 0) + param->target_socket = svt_enc->socket; return 0; } @@ -519,6 +526,8 @@ static const AVOption options[] = { { "tile_columns", "Log2 of number of tile columns to use", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VE}, { "tile_rows", "Log2 of number of tile rows to use", OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 6, VE}, + { "cores", "Number of logical cores, 0: unset", OFFSET(cores), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE}, + { "socket", "Target socket to run on. -1: unset", OFFSET(socket), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE}, {NULL}, };