Commit 30981a96 authored by Michael Niedermayer's avatar Michael Niedermayer

lavc: split snow and dirac DWTs

There is only about 4 lines of common code, so it alot cleaner
when seperated.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 922332e6
......@@ -41,7 +41,6 @@ OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
OBJS-$(CONFIG_DWT) += dwt.o snow.o
OBJS-$(CONFIG_DXVA2) += dxva2.o
OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
......@@ -158,7 +157,7 @@ OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadsp.o \
dca_parser.o synth_filter.o
OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o dca.o
OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o \
dirac_arith.o mpeg12data.o dwt.o
dirac_arith.o mpeg12data.o dirac_dwt.o
OBJS-$(CONFIG_DFA_DECODER) += dfa.o
OBJS-$(CONFIG_DNXHD_DECODER) += dnxhddec.o dnxhddata.o
OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o
......@@ -396,8 +395,8 @@ OBJS-$(CONFIG_SIPR_DECODER) += sipr.o acelp_pitch_delay.o \
OBJS-$(CONFIG_SMACKAUD_DECODER) += smacker.o
OBJS-$(CONFIG_SMACKER_DECODER) += smacker.o
OBJS-$(CONFIG_SMC_DECODER) += smc.o
OBJS-$(CONFIG_SNOW_DECODER) += snowdec.o snow.o
OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o \
OBJS-$(CONFIG_SNOW_DECODER) += snowdec.o snow.o snow_dwt.o
OBJS-$(CONFIG_SNOW_ENCODER) += snowenc.o snow.o snow_dwt.o \
h263.o ituh263enc.o
OBJS-$(CONFIG_SOL_DPCM_DECODER) += dpcm.o
OBJS-$(CONFIG_SONIC_DECODER) += sonic.o
......
This diff is collapsed.
/*
* Copyright (C) 2004-2010 Michael Niedermayer <michaelni@gmx.at>
*
* 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
*/
#ifndef AVCODEC_DIRAC_DWT_H
#define AVCODEC_DIRAC_DWT_H
#include <stdint.h>
typedef int DWTELEM;
typedef short IDWTELEM;
#define MAX_DWT_SUPPORT 8
#define MAX_DECOMPOSITIONS 8
typedef struct DWTCompose {
IDWTELEM *b[MAX_DWT_SUPPORT];
int y;
} DWTCompose;
struct DWTContext;
// Possible prototypes for vertical_compose functions
typedef void (*vertical_compose_2tap)(IDWTELEM *b0, IDWTELEM *b1, int width);
typedef void (*vertical_compose_3tap)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width);
typedef void (*vertical_compose_5tap)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, int width);
typedef void (*vertical_compose_9tap)(IDWTELEM *dst, IDWTELEM *b[8], int width);
typedef struct DWTContext {
IDWTELEM *buffer;
IDWTELEM *temp;
int width;
int height;
int stride;
int decomposition_count;
int support;
void (*spatial_compose)(struct DWTContext *cs, int level, int width, int height, int stride);
void (*vertical_compose_l0)(void);
void (*vertical_compose_h0)(void);
void (*vertical_compose_l1)(void);
void (*vertical_compose_h1)(void);
void (*vertical_compose)(void); ///< one set of lowpass and highpass combined
void (*horizontal_compose)(IDWTELEM *b, IDWTELEM *tmp, int width);
DWTCompose cs[MAX_DECOMPOSITIONS];
} DWTContext;
enum dwt_type {
DWT_SNOW_DAUB9_7,
DWT_SNOW_LEGALL5_3,
DWT_DIRAC_DD9_7,
DWT_DIRAC_LEGALL5_3,
DWT_DIRAC_DD13_7,
DWT_DIRAC_HAAR0,
DWT_DIRAC_HAAR1,
DWT_DIRAC_FIDELITY,
DWT_DIRAC_DAUB9_7,
DWT_NUM_TYPES
};
// -1 if an error occurred, e.g. the dwt_type isn't recognized
int ff_spatial_idwt_init2(DWTContext *d, IDWTELEM *buffer, int width, int height,
int stride, enum dwt_type type, int decomposition_count,
IDWTELEM *temp);
int ff_spatial_idwt2(IDWTELEM *buffer, int width, int height, int stride,
enum dwt_type type, int decomposition_count, IDWTELEM *temp);
void ff_spatial_idwt_slice2(DWTContext *d, int y);
// shared stuff for simd optimiztions
#define COMPOSE_53iL0(b0, b1, b2)\
(b1 - ((b0 + b2 + 2) >> 2))
#define COMPOSE_DIRAC53iH0(b0, b1, b2)\
(b1 + ((b0 + b2 + 1) >> 1))
#define COMPOSE_DD97iH0(b0, b1, b2, b3, b4)\
(b2 + ((-b0 + 9*b1 + 9*b3 - b4 + 8) >> 4))
#define COMPOSE_DD137iL0(b0, b1, b2, b3, b4)\
(b2 - ((-b0 + 9*b1 + 9*b3 - b4 + 16) >> 5))
#define COMPOSE_HAARiL0(b0, b1)\
(b0 - ((b1 + 1) >> 1))
#define COMPOSE_HAARiH0(b0, b1)\
(b0 + b1)
#define COMPOSE_FIDELITYiL0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
(b4 - ((-8*(b0+b8) + 21*(b1+b7) - 46*(b2+b6) + 161*(b3+b5) + 128) >> 8))
#define COMPOSE_FIDELITYiH0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
(b4 + ((-2*(b0+b8) + 10*(b1+b7) - 25*(b2+b6) + 81*(b3+b5) + 128) >> 8))
#define COMPOSE_DAUB97iL1(b0, b1, b2)\
(b1 - ((1817*(b0 + b2) + 2048) >> 12))
#define COMPOSE_DAUB97iH1(b0, b1, b2)\
(b1 - (( 113*(b0 + b2) + 64) >> 7))
#define COMPOSE_DAUB97iL0(b0, b1, b2)\
(b1 + (( 217*(b0 + b2) + 2048) >> 12))
#define COMPOSE_DAUB97iH0(b0, b1, b2)\
(b1 + ((6497*(b0 + b2) + 2048) >> 12))
#endif /* AVCODEC_DWT_H */
......@@ -34,7 +34,7 @@
#include "golomb.h"
#include "dirac_arith.h"
#include "mpeg12data.h"
#include "dwt.h"
#include "dirac_dwt.h"
#include "dirac.h"
#include "diracdsp.h"
......
......@@ -28,7 +28,6 @@
#include "avcodec.h"
#include "dsputil.h"
#include "dwt.h"
#include "ivi_common.h"
#include "ivi_dsp.h"
......@@ -40,7 +39,7 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
int32_t b0_1, b0_2, b1_1, b1_2, b1_3, b2_1, b2_2, b2_3, b2_4, b2_5, b2_6;
int32_t b3_1, b3_2, b3_3, b3_4, b3_5, b3_6, b3_7, b3_8, b3_9;
int32_t pitch, back_pitch;
const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
const short *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
const int num_bands = 4;
/* all bands should have the same pitch */
......@@ -193,7 +192,7 @@ void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst,
const int dst_pitch)
{
int x, y, indx, b0, b1, b2, b3, p0, p1, p2, p3;
const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
const short *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
int32_t pitch;
/* all bands should have the same pitch */
......
......@@ -23,7 +23,7 @@
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
#include "dwt.h"
#include "snow_dwt.h"
#include "internal.h"
#include "snow.h"
#include "snowdata.h"
......
......@@ -23,7 +23,7 @@
#define AVCODEC_SNOW_H
#include "dsputil.h"
#include "dwt.h"
#include "snow_dwt.h"
#include "rangecoder.h"
#include "mathops.h"
......@@ -109,7 +109,7 @@ typedef struct SnowContext{
RangeCoder c;
DSPContext dsp;
VideoDSPContext vdsp;
DWTContext dwt;
SnowDWTContext dwt;
AVFrame new_picture;
AVFrame input_picture; ///< new_picture with the internal linesizes
AVFrame current_picture;
......
This diff is collapsed.
......@@ -18,20 +18,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_DWT_H
#define AVCODEC_DWT_H
#ifndef AVCODEC_SNOW_DWT_H
#define AVCODEC_SNOW_DWT_H
#include <stdint.h>
typedef int DWTELEM;
typedef short IDWTELEM;
#define MAX_DWT_SUPPORT 8
#define MAX_DECOMPOSITIONS 8
typedef struct DWTCompose {
IDWTELEM *b[MAX_DWT_SUPPORT];
IDWTELEM *b0;
IDWTELEM *b1;
IDWTELEM *b2;
......@@ -51,31 +48,9 @@ typedef struct slice_buffer_s {
IDWTELEM *base_buffer; ///< Buffer that this structure is caching.
} slice_buffer;
struct DWTContext;
// Possible prototypes for vertical_compose functions
typedef void (*vertical_compose_2tap)(IDWTELEM *b0, IDWTELEM *b1, int width);
typedef void (*vertical_compose_3tap)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width);
typedef void (*vertical_compose_5tap)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, int width);
typedef void (*vertical_compose_9tap)(IDWTELEM *dst, IDWTELEM *b[8], int width);
typedef struct DWTContext {
IDWTELEM *buffer;
IDWTELEM *temp;
int width;
int height;
int stride;
int decomposition_count;
int support;
void (*spatial_compose)(struct DWTContext *cs, int level, int width, int height, int stride);
void (*vertical_compose_l0)(void);
void (*vertical_compose_h0)(void);
void (*vertical_compose_l1)(void);
void (*vertical_compose_h1)(void);
void (*vertical_compose)(void); ///< one set of lowpass and highpass combined
void (*horizontal_compose)(IDWTELEM *b, IDWTELEM *tmp, int width);
struct SnowDWTContext;
typedef struct SnowDWTContext {
void (*vertical_compose97i)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
int width);
......@@ -84,70 +59,7 @@ typedef struct DWTContext {
uint8_t **block, int b_w, int b_h, int src_x,
int src_y, int src_stride, slice_buffer *sb,
int add, uint8_t *dst8);
DWTCompose cs[MAX_DECOMPOSITIONS];
} DWTContext;
enum dwt_type {
DWT_SNOW_DAUB9_7,
DWT_SNOW_LEGALL5_3,
DWT_DIRAC_DD9_7,
DWT_DIRAC_LEGALL5_3,
DWT_DIRAC_DD13_7,
DWT_DIRAC_HAAR0,
DWT_DIRAC_HAAR1,
DWT_DIRAC_FIDELITY,
DWT_DIRAC_DAUB9_7,
DWT_NUM_TYPES
};
// -1 if an error occurred, e.g. the dwt_type isn't recognized
int ff_spatial_idwt_init2(DWTContext *d, IDWTELEM *buffer, int width, int height,
int stride, enum dwt_type type, int decomposition_count,
IDWTELEM *temp);
int ff_spatial_idwt2(IDWTELEM *buffer, int width, int height, int stride,
enum dwt_type type, int decomposition_count, IDWTELEM *temp);
void ff_spatial_idwt_slice2(DWTContext *d, int y);
// shared stuff for simd optimiztions
#define COMPOSE_53iL0(b0, b1, b2)\
(b1 - ((b0 + b2 + 2) >> 2))
#define COMPOSE_DIRAC53iH0(b0, b1, b2)\
(b1 + ((b0 + b2 + 1) >> 1))
#define COMPOSE_DD97iH0(b0, b1, b2, b3, b4)\
(b2 + ((-b0 + 9*b1 + 9*b3 - b4 + 8) >> 4))
#define COMPOSE_DD137iL0(b0, b1, b2, b3, b4)\
(b2 - ((-b0 + 9*b1 + 9*b3 - b4 + 16) >> 5))
#define COMPOSE_HAARiL0(b0, b1)\
(b0 - ((b1 + 1) >> 1))
#define COMPOSE_HAARiH0(b0, b1)\
(b0 + b1)
#define COMPOSE_FIDELITYiL0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
(b4 - ((-8*(b0+b8) + 21*(b1+b7) - 46*(b2+b6) + 161*(b3+b5) + 128) >> 8))
#define COMPOSE_FIDELITYiH0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\
(b4 + ((-2*(b0+b8) + 10*(b1+b7) - 25*(b2+b6) + 81*(b3+b5) + 128) >> 8))
#define COMPOSE_DAUB97iL1(b0, b1, b2)\
(b1 - ((1817*(b0 + b2) + 2048) >> 12))
#define COMPOSE_DAUB97iH1(b0, b1, b2)\
(b1 - (( 113*(b0 + b2) + 64) >> 7))
#define COMPOSE_DAUB97iL0(b0, b1, b2)\
(b1 + (( 217*(b0 + b2) + 2048) >> 12))
#define COMPOSE_DAUB97iH0(b0, b1, b2)\
(b1 + ((6497*(b0 + b2) + 2048) >> 12))
} SnowDWTContext;
#define DWT_97 0
......@@ -202,14 +114,14 @@ void ff_spatial_dwt(int *buffer, int *temp, int width, int height, int stride,
void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer *sb, int width,
int height, int stride_line, int type,
int decomposition_count);
void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs,
void ff_spatial_idwt_buffered_slice(SnowDWTContext *dsp, DWTCompose *cs,
slice_buffer *slice_buf, IDWTELEM *temp,
int width, int height, int stride_line,
int type, int decomposition_count, int y);
void ff_spatial_idwt(IDWTELEM *buffer, IDWTELEM *temp, int width, int height,
int stride, int type, int decomposition_count);
void ff_dwt_init(DWTContext *c);
void ff_dwt_init_x86(DWTContext *c);
void ff_dwt_init(SnowDWTContext *c);
void ff_dwt_init_x86(SnowDWTContext *c);
#endif /* AVCODEC_DWT_H */
......@@ -23,7 +23,7 @@
#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
#include "dwt.h"
#include "snow_dwt.h"
#include "internal.h"
#include "snow.h"
......
......@@ -25,7 +25,7 @@
#include "internal.h"
#include "dsputil.h"
#include "internal.h"
#include "dwt.h"
#include "snow_dwt.h"
#include "snow.h"
#include "rangecoder.h"
......
......@@ -35,17 +35,17 @@ MMX-OBJS += x86/dsputil_mmx.o \
x86/idct_sse2_xvid.o \
x86/simple_idct.o \
MMX-OBJS-$(CONFIG_DWT) += x86/snowdsp.o \
x86/dwt.o
MMX-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o \
x86/motion_est.o
MMX-OBJS-$(CONFIG_SNOW_DECODER) += x86/snowdsp.o
MMX-OBJS-$(CONFIG_SNOW_ENCODER) += x86/snowdsp.o
MMX-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_mmx.o
YASM-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp.o
YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o
YASM-OBJS-$(CONFIG_DCT) += x86/dct32.o
YASM-OBJS-$(CONFIG_DIRAC_DECODER) += x86/diracdsp_mmx.o x86/diracdsp_yasm.o
YASM-OBJS-$(CONFIG_DWT) += x86/dwt_yasm.o
YASM-OBJS-$(CONFIG_DIRAC_DECODER) += x86/diracdsp_mmx.o x86/diracdsp_yasm.o\
x86/dwt_yasm.o x86/dirac_dwt.o
YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.o
YASM-OBJS-$(CONFIG_FFT) += x86/fft.o
YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \
......
......@@ -22,7 +22,7 @@
#include "libavutil/x86/asm.h"
#include "dsputil_mmx.h"
#include "dwt.h"
#include "dirac_dwt.h"
#define COMPOSE_VERTICAL(ext, align) \
void ff_vertical_compose53iL0##ext(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width); \
......
......@@ -16,10 +16,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_X86_DWT_H
#define AVCODEC_X86_DWT_H
#ifndef AVCODEC_X86_DIRAC_DWT_H
#define AVCODEC_X86_DIRAC_DWT_H
#include "libavcodec/dwt.h"
#include "libavcodec/dirac_dwt.h"
void ff_horizontal_compose_dd97i_end_c(IDWTELEM *b, IDWTELEM *tmp, int w2, int x);
void ff_horizontal_compose_haar1i_end_c(IDWTELEM *b, IDWTELEM *tmp, int w2, int x);
......
......@@ -23,7 +23,7 @@
#include "libavutil/x86/asm.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/snow.h"
#include "libavcodec/dwt.h"
#include "libavcodec/snow_dwt.h"
#include "dsputil_mmx.h"
#if HAVE_INLINE_ASM
......@@ -875,7 +875,7 @@ static void ff_snow_inner_add_yblock_mmx(const uint8_t *obmc, const int obmc_str
#endif /* HAVE_INLINE_ASM */
void ff_dwt_init_x86(DWTContext *c)
void ff_dwt_init_x86(SnowDWTContext *c)
{
#if HAVE_INLINE_ASM
int mm_flags = av_get_cpu_flags();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment