From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id ED7FA4AAB9 for ; Sun, 12 May 2024 16:07:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0631E68D64A; Sun, 12 May 2024 19:07:19 +0300 (EEST) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 917DA68D5BE for ; Sun, 12 May 2024 19:07:12 +0300 (EEST) Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-613a6bb2947so2868713a12.3 for ; Sun, 12 May 2024 09:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715530030; x=1716134830; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TQiZ/F53PQFcSLOTkSx6UtRaS1Ktc5LcPqeLu6JtzSY=; b=Qvj81YBwAjvAhiCfFd2gfUN0Zhf3YJVAA9iVjY8ZUqyeOGir8PFk6k8p+1gDyOPrgw c6dElYZUNB8ibkzsB4qS6DFUQDQBD8ZM6p7THDKbZISJrLt5oroUaadmjPWlxO6Ma8va l4fp8O7dUWAfHfaw25BvoJIDVdZk3/DZJxvm/J47ZCWEGjRUQrw8aItZsLiTQo4A45ca W9nWpPnpvIa+p2D1WCpSyd/tfhul+A22aEjp36P055Spo07TjO80k/dYZ9KWzLzVNU9u 2HBZNXU7IePsOE4zIIMcd+pJtoILIdjH9UGYnH1HnKWcyo2dCn1f1WFN3y5dG6AaRBJ3 3r9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715530030; x=1716134830; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TQiZ/F53PQFcSLOTkSx6UtRaS1Ktc5LcPqeLu6JtzSY=; b=fXJekw3RP2eauU9zCIhSQhShlBipRirqz0M3vrAaVbrunDB24K8v6NRYFXwHhzOKOt VllSUEymzpR1U/wFhoRuBvzllAVrle9IdpsprBvGBQyCev/FMpJjGsxIDA5VL8YZXYQV 2kPuOcQpRvvquTA8NJdtMelbNfGhtxRpM8K122LsKrl1uRVW4gDdc+w024caz3ibq72+ ONgI/GMeIEbNnrmMd9bex7fzGNEVdvGLI5/E+ciMUwx/iaUl4jRe3ISrYidqBLqoZ5Rp Ocr2WUrpbSgzPnXJDvCmftjA4NCNRxcb9clrrTtXNCTd5FzlWOQcc8ecuZ5IMkcKt+3U 9A2A== X-Gm-Message-State: AOJu0YwjhCi5pJV+4W5Rj7yNJW7oBu3xOeGHs0L1yBqAzxbPdgRYhsSo fjA7OdHMm5kHPpdXvLh8BbLJfQsXMjRDxHz3zkUKp271aIF7/oR1kmDdug== X-Google-Smtp-Source: AGHT+IHZtQRDmcHBfl875X1z4qWJKFfvAGnx6lwyvNSAOazD+ot3aNPeh6ofxECvm+1GDug4kGF4aQ== X-Received: by 2002:a05:6a21:c91:b0:1af:9728:de86 with SMTP id adf61e73a8af0-1afde10456emr7216675637.32.1715530030019; Sun, 12 May 2024 09:07:10 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6341134705dsm6274574a12.85.2024.05.12.09.07.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 09:07:09 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sun, 12 May 2024 13:06:53 -0300 Message-ID: <20240512160657.2733-2-jamrial@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240511194656.1576-1-jamrial@gmail.com> References: <20240511194656.1576-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/8] avcodec/flacdsp: split off wasted bit handling into dsp functions 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: James Almer --- libavcodec/flacdec.c | 8 ++------ libavcodec/flacdsp.c | 20 ++++++++++++++++++++ libavcodec/flacdsp.h | 3 +++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 91bbdc657d..6e6a2896b4 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -602,13 +602,9 @@ static inline int decode_subframe(FLACContext *s, int channel) if (wasted) { if (wasted+bps == 33) { - int i; - for (i = 0; i < s->blocksize; i++) - s->decoded_33bps[i] = (uint64_t)decoded[i] << wasted; + s->dsp.wasted33(s->decoded_33bps, decoded, wasted, s->blocksize); } else if (wasted < 32) { - int i; - for (i = 0; i < s->blocksize; i++) - decoded[i] = (unsigned)decoded[i] << wasted; + s->dsp.wasted32(decoded, wasted, s->blocksize); } } diff --git a/libavcodec/flacdsp.c b/libavcodec/flacdsp.c index 71b4ac44aa..610831348a 100644 --- a/libavcodec/flacdsp.c +++ b/libavcodec/flacdsp.c @@ -84,11 +84,31 @@ static void flac_lpc_32_c(int32_t *decoded, const int coeffs[32], } +static void flac_wasted_32_c(int32_t *decoded, int wasted, int len) +{ + int i; + + for (i = 0; i < len; i++) + decoded[i] = (unsigned)decoded[i] << wasted; +} + +static void flac_wasted_33_c(int64_t *decoded, const int32_t *residual, + int wasted, int len) +{ + int i; + + for (i = 0; i < len; i++) + decoded[i] = (uint64_t)residual[i] << wasted; +} + av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels) { c->lpc16 = flac_lpc_16_c; c->lpc32 = flac_lpc_32_c; + c->wasted32 = flac_wasted_32_c; + c->wasted33 = flac_wasted_33_c; + switch (fmt) { case AV_SAMPLE_FMT_S32: c->decorrelate[0] = flac_decorrelate_indep_c_32; diff --git a/libavcodec/flacdsp.h b/libavcodec/flacdsp.h index 15149c026e..5a59c0c864 100644 --- a/libavcodec/flacdsp.h +++ b/libavcodec/flacdsp.h @@ -30,6 +30,9 @@ typedef struct FLACDSPContext { int qlevel, int len); void (*lpc32)(int32_t *samples, const int coeffs[32], int order, int qlevel, int len); + void (*wasted32)(int32_t *decoded, int wasted, int len); + void (*wasted33)(int64_t *decoded, const int32_t *residual, + int wasted, int len); void (*lpc16_encode)(int32_t *res, const int32_t *smp, int len, int order, const int32_t coefs[32], int shift); void (*lpc32_encode)(int32_t *res, const int32_t *smp, int len, int order, -- 2.45.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".