From patchwork Sun Aug 8 22:56:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 29366 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp2364440ioh; Sun, 8 Aug 2021 15:56:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKWVDphh7tZ4qlt3cOSFJPXuep37vhMR5RATCxCLTkNmc/pE1mDvVnPdREGOkz6f3K+OrL X-Received: by 2002:aa7:d3cf:: with SMTP id o15mr3883082edr.98.1628463416527; Sun, 08 Aug 2021 15:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628463416; cv=none; d=google.com; s=arc-20160816; b=geX6zYLo9zz48xMCtAi9MYM8ovEP2XMunRJQWpmcXnfQX7lj/2Bs7EWQbQESLEWyyk WjhCB1S8NOFu4l3hwBBUw0V8+uVjFCYamyw/enstaY5qaSA6NSYol0ZKvSwfwo1T9BgJ o+Gmmo7gmRh+ZC3gFJ0fUZ9uj5GkBWZ6Z2bzEO8tH/SZD8pDlbTOOFhOxNJfD+3lUlLn 7J/E6kYJ83cOEylg+/sqDYtJ+F/Bg3wNt8TPy5n4lwuB3Orqtp2CXT05x+m03VZq3T4L L4ZpIo0/yUgHLw9DbSgOcUP0vbUA0dLBxKRbUdJeFqScluGuguszyvFjXi/30ZJP/ISJ xhag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=dKsGPWdKgERM0Xlc+Jdjbkpx9gsIJYQ6o9qUT5RhvI0=; b=GAnpMJ25fX3Z3Wxot56MqjJbD6qpy5WrbCWMWuk5YWuvQDH/xFzN3cRm/WBuzNIMTH F1h/nWokBQ/CsaTFbtB1AYvHw8wJz/ktrX9Hbf53vcByhHeMu+OiEZc2UOWCjHw1MWq7 dMgrHvhdB4cReonpIzVB6wmf3LRKOAtZ3Jbl6M7/9kfJewPQq7AL1h5rfVFJ9iSHDDfS x6taEQwir7oubYPRG1XiQ7eJEPIfXZz8r1dFD4uecmBXlml4CO1BLP0wQ/G51445gGdn OA13CUie3/1UMkdJNA7BmYKD9QzxlKWXl8+Y+7GrW2mqGPh6hai4QupKfY6QgbICu9xT LL4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=kRow5auL; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b14si15334968edd.329.2021.08.08.15.56.55; Sun, 08 Aug 2021 15:56:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=kRow5auL; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7308E68A3B7; Mon, 9 Aug 2021 01:56:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5683068A0F1 for ; Mon, 9 Aug 2021 01:56:46 +0300 (EEST) Received: by mail-pj1-f42.google.com with SMTP id e2-20020a17090a4a02b029016f3020d867so27168169pjh.3 for ; Sun, 08 Aug 2021 15:56:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YbY9YUYq2gODTPqSl6XDj3fSH3R1DT3GWPZEFBzWb8E=; b=kRow5auLvYE8CgkGYU1y/R+gpp8lgOVqjCZsf9GVpUfVdy9L5GtfVBULSTvr3cR+a2 mrLX4q6n2Qv7O+BfrhC7vIy4W+JwG6q8wnxuvneBbuoIBDOz1I+xRzKRCD67uiDMEDi6 ZCpw4oHDAgXiL5FePDOc5zkbTexFiMXjLfM1mEHqhQTuwEIBunUHxesnCqNj55TSYgWf PyfHBCh4d5ZO6AMGniSWeWS0l0PkN4iMa7pqb4vxJyvGvYxwRuWvpaXdsLnD/B7wO1y2 Fb2fewyUIsRh3EPQ25lcYDYLKfBW9f1me/ZkwFKnVcogrnYxibZG+vIPmgi5tdEoNPoH QeCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=YbY9YUYq2gODTPqSl6XDj3fSH3R1DT3GWPZEFBzWb8E=; b=Oc/KHVFONyNy6gcDEGcajb+9Eo0TdpMroJVyRZU9Sc1/yvVvvBppPOCnNZ0Xu5kXGK uMI0aitlcAQoKR0Dg6NBxuLnCnTHcrC+yz8tzX20I2hgeVG/kWcsp4aE/DM2sAhMhzjh /+6KDIa1V/IRzFmb19I47CEHxXOAfwN2hIX6mvtK/LiZDDosskyMJ0u6dMSfQ7fOPZ6d ap9HIPxK+RllmCNUYHBmJ2zMkRc9Q3BVF4yURqhFJuhR9LNDkyt2xMwLUu+w/SU6DI3h 3qGGzOFixS6EccFAR9bDpzkmM3Hqti0QmTaCmthAgzirHZt4XhYtY9EDpWFCpYH6UB9Q dVTw== X-Gm-Message-State: AOAM530T0fbMlpQ35usaPEvgb2ZcpDf6PKOijQIBRb0zV0NrVwTQbb2t qIvPUCdYB2LZP48wa2i1uTKn1FpKNzg= X-Received: by 2002:a63:5fd4:: with SMTP id t203mr131157pgb.141.1628463404330; Sun, 08 Aug 2021 15:56:44 -0700 (PDT) Received: from localhost.localdomain ([191.84.233.71]) by smtp.gmail.com with ESMTPSA id t9sm22337491pgc.81.2021.08.08.15.56.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Aug 2021 15:56:43 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Aug 2021 19:56:10 -0300 Message-Id: <20210808225612.11600-1-jamrial@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/h264_picture: split copying some H264Picture fields into a separate function X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PpvTDGBVArAN Signed-off-by: James Almer --- libavcodec/h264_picture.c | 57 ++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c index eec5e9fb9a..89aef37edd 100644 --- a/libavcodec/h264_picture.c +++ b/libavcodec/h264_picture.c @@ -63,6 +63,38 @@ void ff_h264_unref_picture(H264Context *h, H264Picture *pic) memset((uint8_t*)pic + off, 0, sizeof(*pic) - off); } +static void h264_copy_picture_params(H264Picture *dst, H264Picture *src) +{ + dst->qscale_table = src->qscale_table; + dst->mb_type = src->mb_type; + dst->pps = src->pps; + + for (int i = 0; i < 2; i++) { + dst->motion_val[i] = src->motion_val[i]; + dst->ref_index[i] = src->ref_index[i]; + } + + for (int i = 0; i < 2; i++) + dst->field_poc[i] = src->field_poc[i]; + + memcpy(dst->ref_poc, src->ref_poc, sizeof(src->ref_poc)); + memcpy(dst->ref_count, src->ref_count, sizeof(src->ref_count)); + + dst->poc = src->poc; + dst->frame_num = src->frame_num; + dst->mmco_reset = src->mmco_reset; + dst->long_ref = src->long_ref; + dst->mbaff = src->mbaff; + dst->field_picture = src->field_picture; + dst->reference = src->reference; + dst->recovered = src->recovered; + dst->invalid_gap = src->invalid_gap; + dst->sei_recovery_frame_cnt = src->sei_recovery_frame_cnt; + dst->mb_width = src->mb_width; + dst->mb_height = src->mb_height; + dst->mb_stride = src->mb_stride; +} + int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) { int ret, i; @@ -83,9 +115,6 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) ret = AVERROR(ENOMEM); goto fail; } - dst->qscale_table = src->qscale_table; - dst->mb_type = src->mb_type; - dst->pps = src->pps; for (i = 0; i < 2; i++) { dst->motion_val_buf[i] = av_buffer_ref(src->motion_val_buf[i]); @@ -94,8 +123,6 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) ret = AVERROR(ENOMEM); goto fail; } - dst->motion_val[i] = src->motion_val[i]; - dst->ref_index[i] = src->ref_index[i]; } if (src->hwaccel_picture_private) { @@ -107,25 +134,7 @@ int ff_h264_ref_picture(H264Context *h, H264Picture *dst, H264Picture *src) dst->hwaccel_picture_private = dst->hwaccel_priv_buf->data; } - for (i = 0; i < 2; i++) - dst->field_poc[i] = src->field_poc[i]; - - memcpy(dst->ref_poc, src->ref_poc, sizeof(src->ref_poc)); - memcpy(dst->ref_count, src->ref_count, sizeof(src->ref_count)); - - dst->poc = src->poc; - dst->frame_num = src->frame_num; - dst->mmco_reset = src->mmco_reset; - dst->long_ref = src->long_ref; - dst->mbaff = src->mbaff; - dst->field_picture = src->field_picture; - dst->reference = src->reference; - dst->recovered = src->recovered; - dst->invalid_gap = src->invalid_gap; - dst->sei_recovery_frame_cnt = src->sei_recovery_frame_cnt; - dst->mb_width = src->mb_width; - dst->mb_height = src->mb_height; - dst->mb_stride = src->mb_stride; + h264_copy_picture_params(dst, src); return 0; fail: