mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 12:50:49 +08:00
avcodec/wmv2dsp: Modify IDCTDSPContext directly
This allows to remove ff_wmv2_common_init() altogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
1
configure
vendored
1
configure
vendored
@@ -2963,6 +2963,7 @@ msmpeg4dec_select="h263_decoder"
|
||||
msmpeg4enc_select="h263_encoder"
|
||||
vc1dsp_select="h264chroma startcode"
|
||||
vvc_sei_select="atsc_a53 golomb"
|
||||
wmv2dsp_select="idctdsp"
|
||||
|
||||
# decoders / encoders
|
||||
aac_decoder_select="adts_header mpeg4audio sinewin"
|
||||
|
||||
@@ -854,8 +854,8 @@ OBJS-$(CONFIG_WMAV2_ENCODER) += wmaenc.o wma.o wma_common.o aactab.o
|
||||
OBJS-$(CONFIG_WMAVOICE_DECODER) += wmavoice.o \
|
||||
celp_filters.o \
|
||||
acelp_vectors.o acelp_filters.o
|
||||
OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o wmv2data.o
|
||||
OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o wmv2data.o
|
||||
OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2data.o
|
||||
OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2data.o
|
||||
OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o
|
||||
OBJS-$(CONFIG_WRAPPED_AVFRAME_DECODER) += wrapped_avframe.o
|
||||
OBJS-$(CONFIG_WRAPPED_AVFRAME_ENCODER) += wrapped_avframe.o
|
||||
|
||||
@@ -437,7 +437,7 @@ static void x8_ac_compensation(IntraX8Context *const w, const int direction,
|
||||
const int dc_level)
|
||||
{
|
||||
int t;
|
||||
#define B(x,y) w->block[w->idct_permutation[(x) + (y) * 8]]
|
||||
#define B(x,y) w->block[w->idsp.idct_permutation[(x) + (y) * 8]]
|
||||
#define T(x) ((x) * dc_level + 0x8000) >> 16;
|
||||
switch (direction) {
|
||||
case 0:
|
||||
@@ -637,7 +637,7 @@ static int x8_decode_intra_mb(IntraX8Context *const w, const int chroma)
|
||||
w->frame->linesize[!!chroma]);
|
||||
}
|
||||
if (!zeros_only)
|
||||
w->wdsp.idct_add(w->dest[chroma],
|
||||
w->idsp.idct_add(w->dest[chroma],
|
||||
w->frame->linesize[!!chroma],
|
||||
w->block);
|
||||
|
||||
@@ -693,17 +693,14 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
|
||||
if (!w->prediction_table)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ff_wmv2dsp_init(&w->wdsp);
|
||||
|
||||
ff_init_scantable_permutation(w->idct_permutation,
|
||||
w->wdsp.idct_perm);
|
||||
ff_wmv2dsp_init(&w->idsp);
|
||||
|
||||
ff_permute_scantable(w->permutated_scantable[0], ff_wmv1_scantable[0],
|
||||
w->idct_permutation);
|
||||
w->idsp.idct_permutation);
|
||||
ff_permute_scantable(w->permutated_scantable[1], ff_wmv1_scantable[2],
|
||||
w->idct_permutation);
|
||||
w->idsp.idct_permutation);
|
||||
ff_permute_scantable(w->permutated_scantable[2], ff_wmv1_scantable[3],
|
||||
w->idct_permutation);
|
||||
w->idsp.idct_permutation);
|
||||
|
||||
ff_intrax8dsp_init(&w->dsp);
|
||||
ff_blockdsp_init(&w->bdsp);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "blockdsp.h"
|
||||
#include "get_bits.h"
|
||||
#include "idctdsp.h"
|
||||
#include "intrax8dsp.h"
|
||||
#include "wmv2dsp.h"
|
||||
#include "mpegpicture.h"
|
||||
@@ -35,8 +36,7 @@ typedef struct IntraX8Context {
|
||||
// set by ff_intrax8_common_init
|
||||
uint8_t *prediction_table; // 2 * (mb_w * 2)
|
||||
uint8_t permutated_scantable[3][64];
|
||||
WMV2DSPContext wdsp;
|
||||
uint8_t idct_permutation[64];
|
||||
IDCTDSPContext idsp;
|
||||
AVCodecContext *avctx;
|
||||
int16_t *block;
|
||||
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
#include "libavutil/mips/cpu.h"
|
||||
#include "config.h"
|
||||
#include "libavutil/attributes.h"
|
||||
#include "libavcodec/idctdsp.h"
|
||||
#include "libavcodec/wmv2dsp.h"
|
||||
#include "wmv2dsp_mips.h"
|
||||
|
||||
av_cold void ff_wmv2dsp_init_mips(WMV2DSPContext *c)
|
||||
av_cold void ff_wmv2dsp_init_mips(IDCTDSPContext *c)
|
||||
{
|
||||
int cpu_flags = av_get_cpu_flags();
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#ifndef AVCODEC_MIPS_WMV2DSP_MIPS_H
|
||||
#define AVCODEC_MIPS_WMV2DSP_MIPS_H
|
||||
|
||||
#include "libavcodec/wmv2dsp.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void ff_wmv2_idct_add_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t *block);
|
||||
void ff_wmv2_idct_put_mmi(uint8_t *dest, ptrdiff_t line_size, int16_t *block);
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "mpeg4videodata.h"
|
||||
#include "msmpeg4data.h"
|
||||
#include "msmpeg4_vc1_data.h"
|
||||
#include "wmv2.h"
|
||||
#include "wmv2dsp.h"
|
||||
|
||||
/*
|
||||
* You can also call this codec: MPEG-4 with a twist!
|
||||
@@ -140,7 +140,7 @@ av_cold void ff_msmpeg4_common_init(MpegEncContext *s)
|
||||
break;
|
||||
#if CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER
|
||||
case MSMP4_WMV2:
|
||||
ff_wmv2_common_init(s);
|
||||
ff_wmv2dsp_init(&s->idsp);
|
||||
// fallthrough
|
||||
#endif
|
||||
case MSMP4_WMV1:
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002 The FFmpeg Project
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "idctdsp.h"
|
||||
#include "mpegvideo.h"
|
||||
#include "wmv2.h"
|
||||
|
||||
|
||||
av_cold void ff_wmv2_common_init(MpegEncContext *s)
|
||||
{
|
||||
WMV2Context *const w = s->private_ctx;
|
||||
|
||||
ff_wmv2dsp_init(&w->wdsp);
|
||||
s->idsp.perm_type = w->wdsp.idct_perm;
|
||||
ff_init_scantable_permutation(s->idsp.idct_permutation,
|
||||
w->wdsp.idct_perm);
|
||||
s->idsp.idct_put = w->wdsp.idct_put;
|
||||
s->idsp.idct_add = w->wdsp.idct_add;
|
||||
s->idsp.idct = NULL;
|
||||
}
|
||||
@@ -21,8 +21,9 @@
|
||||
#ifndef AVCODEC_WMV2_H
|
||||
#define AVCODEC_WMV2_H
|
||||
|
||||
#include "mpegvideo.h"
|
||||
#include "wmv2dsp.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/attributes.h"
|
||||
|
||||
#define SKIP_TYPE_NONE 0
|
||||
#define SKIP_TYPE_MPEG 1
|
||||
@@ -31,12 +32,9 @@
|
||||
|
||||
|
||||
typedef struct WMV2Context {
|
||||
WMV2DSPContext wdsp;
|
||||
int hshift;
|
||||
} WMV2Context;
|
||||
|
||||
void ff_wmv2_common_init(MpegEncContext *s);
|
||||
|
||||
static av_always_inline int wmv2_get_cbp_table_index(int qscale, int cbp_index)
|
||||
{
|
||||
static const uint8_t map[3][3] = {
|
||||
|
||||
@@ -277,7 +277,7 @@ static void wmv2_add_block(WMV2DecContext *w, int16_t blocks1[][64],
|
||||
int16_t *block1 = blocks1[n];
|
||||
switch (w->abt_type_table[n]) {
|
||||
case 0:
|
||||
w->common.wdsp.idct_add(dst, stride, block1);
|
||||
h->c.idsp.idct_add(dst, stride, block1);
|
||||
break;
|
||||
case 1:
|
||||
ff_simple_idct84_add(dst, stride, block1);
|
||||
|
||||
@@ -139,13 +139,16 @@ static void wmv2_idct_put_c(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
|
||||
}
|
||||
}
|
||||
|
||||
av_cold void ff_wmv2dsp_init(WMV2DSPContext *c)
|
||||
av_cold void ff_wmv2dsp_init(IDCTDSPContext *c)
|
||||
{
|
||||
c->idct_add = wmv2_idct_add_c;
|
||||
c->idct_put = wmv2_idct_put_c;
|
||||
c->idct_perm = FF_IDCT_PERM_NONE;
|
||||
c->idct = NULL;
|
||||
c->perm_type = FF_IDCT_PERM_NONE;
|
||||
|
||||
#if ARCH_MIPS
|
||||
ff_wmv2dsp_init_mips(c);
|
||||
#endif
|
||||
ff_init_scantable_permutation(c->idct_permutation,
|
||||
c->perm_type);
|
||||
}
|
||||
|
||||
@@ -19,17 +19,9 @@
|
||||
#ifndef AVCODEC_WMV2DSP_H
|
||||
#define AVCODEC_WMV2DSP_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
struct IDCTDSPContext;
|
||||
|
||||
typedef struct WMV2DSPContext {
|
||||
void (*idct_add)(uint8_t *dest, ptrdiff_t line_size, int16_t *block);
|
||||
void (*idct_put)(uint8_t *dest, ptrdiff_t line_size, int16_t *block);
|
||||
|
||||
int idct_perm;
|
||||
} WMV2DSPContext;
|
||||
|
||||
void ff_wmv2dsp_init(WMV2DSPContext *c);
|
||||
void ff_wmv2dsp_init_mips(WMV2DSPContext *c);
|
||||
void ff_wmv2dsp_init(struct IDCTDSPContext *c);
|
||||
void ff_wmv2dsp_init_mips(struct IDCTDSPContext *c);
|
||||
|
||||
#endif /* AVCODEC_WMV2DSP_H */
|
||||
|
||||
Reference in New Issue
Block a user