avcodec/proresdsp: Pass necessary parameter directly

Only avctx->bits_per_raw_sample is used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2023-09-08 12:49:28 +02:00
parent 489d96ca02
commit 7b0b9a25ed
4 changed files with 9 additions and 10 deletions

View File

@ -172,7 +172,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
ff_blockdsp_init(&ctx->bdsp);
ret = ff_proresdsp_init(&ctx->prodsp, avctx);
ret = ff_proresdsp_init(&ctx->prodsp, avctx->bits_per_raw_sample);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Fail to init proresdsp for bits per raw sample %d\n", avctx->bits_per_raw_sample);
return ret;

View File

@ -76,12 +76,12 @@ static void prores_idct_put_12_c(uint16_t *out, ptrdiff_t linesize, int16_t *blo
put_pixels_12(out, linesize >> 1, block);
}
av_cold int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
av_cold int ff_proresdsp_init(ProresDSPContext *dsp, int bits_per_raw_sample)
{
if (avctx->bits_per_raw_sample == 10) {
if (bits_per_raw_sample == 10) {
dsp->idct_put = prores_idct_put_10_c;
dsp->idct_permutation_type = FF_IDCT_PERM_NONE;
} else if (avctx->bits_per_raw_sample == 12) {
} else if (bits_per_raw_sample == 12) {
dsp->idct_put = prores_idct_put_12_c;
dsp->idct_permutation_type = FF_IDCT_PERM_NONE;
} else {
@ -89,7 +89,7 @@ av_cold int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx)
}
#if ARCH_X86
ff_proresdsp_init_x86(dsp, avctx);
ff_proresdsp_init_x86(dsp, bits_per_raw_sample);
#endif
ff_init_scantable_permutation(dsp->idct_permutation,

View File

@ -25,7 +25,6 @@
#include <stddef.h>
#include <stdint.h>
#include "avcodec.h"
typedef struct ProresDSPContext {
int idct_permutation_type;
@ -33,8 +32,8 @@ typedef struct ProresDSPContext {
void (*idct_put)(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat);
} ProresDSPContext;
int ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx);
int ff_proresdsp_init(ProresDSPContext *dsp, int bits_per_raw_sample);
void ff_proresdsp_init_x86(ProresDSPContext *dsp, AVCodecContext *avctx);
void ff_proresdsp_init_x86(ProresDSPContext *dsp, int bits_per_raw_sample);
#endif /* AVCODEC_PRORESDSP_H */

View File

@ -30,12 +30,12 @@ void ff_prores_idct_put_10_sse2(uint16_t *dst, ptrdiff_t linesize,
void ff_prores_idct_put_10_avx (uint16_t *dst, ptrdiff_t linesize,
int16_t *block, const int16_t *qmat);
av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp, AVCodecContext *avctx)
av_cold void ff_proresdsp_init_x86(ProresDSPContext *dsp, int bits_per_raw_sample)
{
#if ARCH_X86_64
int cpu_flags = av_get_cpu_flags();
if (avctx->bits_per_raw_sample == 10){
if (bits_per_raw_sample == 10) {
if (EXTERNAL_SSE2(cpu_flags)) {
dsp->idct_permutation_type = FF_IDCT_PERM_TRANSPOSE;
dsp->idct_put = ff_prores_idct_put_10_sse2;