From patchwork Sat Aug 14 11:24:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mapul Bhola X-Patchwork-Id: 29504 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp373573iov; Sat, 14 Aug 2021 04:25:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFk8kLs+LeP4lK+tN7/rkG4m2xvHH+RmmtxHxnhLlHsZXM2SpBWRxhWM0iqBoIhR7fhMjH X-Received: by 2002:a17:906:5d06:: with SMTP id g6mr6877052ejt.96.1628940308914; Sat, 14 Aug 2021 04:25:08 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hq14si4714814ejc.450.2021.08.14.04.25.08; Sat, 14 Aug 2021 04:25:08 -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=@e.email header.s=mail1 header.b="NtcNbv/z"; arc=fail (body hash mismatch); 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=QUARANTINE sp=REJECT dis=NONE) header.from=e.email Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4049468A5FE; Sat, 14 Aug 2021 14:25:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.ecloud.global (mail.ecloud.global [135.181.85.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7669268A3A8 for ; Sat, 14 Aug 2021 14:24:57 +0300 (EEST) Received: from authenticated-user (mail.ecloud.global [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.ecloud.global (Postfix) with ESMTPSA id 687662000126A0C3 for ; Sat, 14 Aug 2021 11:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=e.email; s=mail1; t=1628940296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+5ArEpRl9kKv/WLhh6bAVEtH5fkpNaWMJYmqMBXoQQM=; b=NtcNbv/zG+xdK8fACJzwDtaRtlOMT3RzzQF1y2FDbHbeKMA8ffbBU9FG021g3vCsxBZ5My UJio2WpWBK4Q2XkMioOD6kcmqDIhiCJEzEYdqkXIm5xlw3oRfOjh+bz3ZjHEMkvewGtTAA a6kv1/XFYjcmU1Z6jHCV50moHbZ3z00= MIME-Version: 1.0 Date: Sat, 14 Aug 2021 11:24:56 +0000 From: "ffmpegandmahanstreamer" Message-ID: <7ec1ea95c3bee3d38e8c5c4995ae68db@e.email> To: ffmpeg-devel@ffmpeg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=e.email; s=mail1; t=1628940296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+5ArEpRl9kKv/WLhh6bAVEtH5fkpNaWMJYmqMBXoQQM=; b=tEq4d8GYAwTJtUC1WKJIASR+eG/GRa/24BN7J38pNkadOJItd56sDgYPQlJwGFZKvU+KSu Mgea2WOUG3iReAwpBsmkfkdEBxs38CXho9TLRvzzXDj2nivzpo+bsbGqBg16l2qySnUiL+ oRaZHo5SuupzW2xC4eOFM5lm6rLIfmU= ARC-Seal: i=1; s=mail1; d=e.email; t=1628940296; a=rsa-sha256; cv=none; b=lpPEmfCXRMMVXQSYOjwbMdwJrosmdaGhMnXZfIXDPapPRKhKFftkbawd5fFp0yAaCr8EpA tTZZyIvxRnVja6UdNXSslYhuaqzb3JLubny2Dy7e7cXQa6b5rzG8UTjRjXDznZLMeUq2I1 NcL5OYrqFGfYSN0moJoRxYpzndHaHUY= ARC-Authentication-Results: i=1; mail.ecloud.global; auth=pass smtp.mailfrom=ffmpegandmahanstreamer@e.email Subject: [FFmpeg-devel] [PATCH] Cleanup prediction code in truemotion1_decode_16bit and truemotion1_decode_24bit of truemotion1 decoder 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: pENucVTkhid/ This cleans up the code in the decode24bit and decode16bit functions by putting it in way that expresses the true intent while making it easier to read. --- libavcodec/truemotion1.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index 32d8fb4005..3f13de0ff8 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -660,20 +660,14 @@ static void truemotion1_decode_16bit(TrueMotion1Context *s) case 0: /* if macroblock width is 2, apply C-Y-C-Y; else * apply C-Y-Y */ + APPLY_C_PREDICTOR(); + APPLY_Y_PREDICTOR(); + OUTPUT_PIXEL_PAIR(); if (s->block_width == 2) { - APPLY_C_PREDICTOR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - APPLY_C_PREDICTOR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - } else { - APPLY_C_PREDICTOR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); - APPLY_Y_PREDICTOR(); - OUTPUT_PIXEL_PAIR(); + APPLY_C_PREDICTOR(); } + APPLY_Y_PREDICTOR(); + OUTPUT_PIXEL_PAIR(); break; case 1: @@ -786,22 +780,17 @@ static void truemotion1_decode_24bit(TrueMotion1Context *s) case 0: /* if macroblock width is 2, apply C-Y-C-Y; else * apply C-Y-Y */ + APPLY_C_PREDICTOR_24(); + APPLY_Y_PREDICTOR_24(); + OUTPUT_PIXEL_PAIR(); if (s->block_width == 2) { APPLY_C_PREDICTOR_24(); - APPLY_Y_PREDICTOR_24(); - OUTPUT_PIXEL_PAIR(); - APPLY_C_PREDICTOR_24(); - APPLY_Y_PREDICTOR_24(); - OUTPUT_PIXEL_PAIR(); - } else { - APPLY_C_PREDICTOR_24(); - APPLY_Y_PREDICTOR_24(); - OUTPUT_PIXEL_PAIR(); - APPLY_Y_PREDICTOR_24(); - OUTPUT_PIXEL_PAIR(); } + APPLY_Y_PREDICTOR_24(); + OUTPUT_PIXEL_PAIR(); break; + case 1: case 3: /* always apply 2 Y predictors on these iterations */