[FFmpeg-cvslog] intrax8: move functions from dsputil to own context
Mans Rullgard
git at videolan.org
Sun Sep 2 21:06:43 CEST 2012
ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Aug 25 14:35:52 2012 +0100| [15616eb04206b64bcf08ad351f4c754e69e00666] | committer: Mans Rullgard
intrax8: move functions from dsputil to own context
Signed-off-by: Mans Rullgard <mans at mansr.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=15616eb04206b64bcf08ad351f4c754e69e00666
---
libavcodec/dsputil.c | 3 ---
libavcodec/dsputil.h | 9 ---------
libavcodec/intrax8.c | 15 +++++++++------
libavcodec/intrax8.h | 2 ++
libavcodec/intrax8dsp.c | 34 ++++++++++++++++++----------------
libavcodec/intrax8dsp.h | 33 +++++++++++++++++++++++++++++++++
6 files changed, 62 insertions(+), 34 deletions(-)
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index c78fe40..d38464b 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2797,9 +2797,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
ff_mlp_init(c, avctx);
#endif
-#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER
- ff_intrax8dsp_init(c,avctx);
-#endif
c->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c;
c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index e818fb0..e47cd2c 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -372,9 +372,6 @@ typedef struct DSPContext {
void (*h261_loop_filter)(uint8_t *src, int stride);
- void (*x8_v_loop_filter)(uint8_t *src, int stride, int qscale);
- void (*x8_h_loop_filter)(uint8_t *src, int stride, int qscale);
-
/* assume len is a multiple of 4, and arrays are 16-byte aligned */
void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize);
void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len);
@@ -489,11 +486,6 @@ typedef struct DSPContext {
unsigned int filter_shift, int32_t mask, int blocksize,
int32_t *sample_buffer);
- /* intrax8 functions */
- void (*x8_spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize);
- void (*x8_setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize,
- int * range, int * sum, int edges);
-
/**
* Calculate scalar product of two vectors.
* @param len length of vectors, should be multiple of 16
@@ -621,7 +613,6 @@ void ff_dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
void ff_dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
void ff_dsputil_init_dwt(DSPContext *c);
-void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx);
void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx);
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index 17426c5..fad7ffe 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -27,6 +27,7 @@
#include "msmpeg4data.h"
#include "intrax8huf.h"
#include "intrax8.h"
+#include "intrax8dsp.h"
#define MAX_TABLE_DEPTH(table_bits, max_bits) ((max_bits+table_bits-1)/table_bits)
@@ -303,9 +304,9 @@ static int x8_setup_spatial_predictor(IntraX8Context * const w, const int chroma
int sum;
int quant;
- s->dsp.x8_setup_spatial_compensation(s->dest[chroma], s->edge_emu_buffer,
- s->current_picture.f.linesize[chroma>0],
- &range, &sum, w->edges);
+ w->dsp.setup_spatial_compensation(s->dest[chroma], s->edge_emu_buffer,
+ s->current_picture.f.linesize[chroma>0],
+ &range, &sum, w->edges);
if(chroma){
w->orient=w->chroma_orient;
quant=w->quant_dc_chroma;
@@ -639,7 +640,7 @@ static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){
if(w->flat_dc){
dsp_x8_put_solidcolor(w->predicted_dc, s->dest[chroma], s->current_picture.f.linesize[!!chroma]);
}else{
- s->dsp.x8_spatial_compensation[w->orient]( s->edge_emu_buffer,
+ w->dsp.spatial_compensation[w->orient]( s->edge_emu_buffer,
s->dest[chroma],
s->current_picture.f.linesize[!!chroma] );
}
@@ -659,10 +660,10 @@ block_placed:
int linesize = s->current_picture.f.linesize[!!chroma];
if(!( (w->edges&2) || ( zeros_only && (w->orient|4)==4 ) )){
- s->dsp.x8_h_loop_filter(ptr, linesize, w->quant);
+ w->dsp.h_loop_filter(ptr, linesize, w->quant);
}
if(!( (w->edges&1) || ( zeros_only && (w->orient|8)==8 ) )){
- s->dsp.x8_v_loop_filter(ptr, linesize, w->quant);
+ w->dsp.v_loop_filter(ptr, linesize, w->quant);
}
}
return 0;
@@ -699,6 +700,8 @@ av_cold void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s
ff_init_scantable(s->dsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]);
ff_init_scantable(s->dsp.idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]);
ff_init_scantable(s->dsp.idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]);
+
+ ff_intrax8dsp_init(&w->dsp);
}
/**
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
index 3a58938..be984f8 100644
--- a/libavcodec/intrax8.h
+++ b/libavcodec/intrax8.h
@@ -21,6 +21,7 @@
#include "get_bits.h"
#include "mpegvideo.h"
+#include "intrax8dsp.h"
typedef struct{
VLC * j_ac_vlc[4];//they point to the static j_mb_vlc
@@ -33,6 +34,7 @@ typedef struct{
ScanTable scantable[3];
//set by the caller codec
MpegEncContext * s;
+ IntraX8DSPContext dsp;
int quant;
int dquant;
int qsum;
diff --git a/libavcodec/intrax8dsp.c b/libavcodec/intrax8dsp.c
index 5ba210e..ddceb2c 100644
--- a/libavcodec/intrax8dsp.c
+++ b/libavcodec/intrax8dsp.c
@@ -22,6 +22,7 @@
*/
#include "dsputil.h"
+#include "intrax8dsp.h"
#include "libavutil/common.h"
/*
@@ -412,20 +413,21 @@ static void x8_v_loop_filter(uint8_t *src, int stride, int qscale){
x8_loop_filter(src, 1, stride, qscale);
}
-av_cold void ff_intrax8dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
- dsp->x8_h_loop_filter=x8_h_loop_filter;
- dsp->x8_v_loop_filter=x8_v_loop_filter;
- dsp->x8_setup_spatial_compensation=x8_setup_spatial_compensation;
- dsp->x8_spatial_compensation[0]=spatial_compensation_0;
- dsp->x8_spatial_compensation[1]=spatial_compensation_1;
- dsp->x8_spatial_compensation[2]=spatial_compensation_2;
- dsp->x8_spatial_compensation[3]=spatial_compensation_3;
- dsp->x8_spatial_compensation[4]=spatial_compensation_4;
- dsp->x8_spatial_compensation[5]=spatial_compensation_5;
- dsp->x8_spatial_compensation[6]=spatial_compensation_6;
- dsp->x8_spatial_compensation[7]=spatial_compensation_7;
- dsp->x8_spatial_compensation[8]=spatial_compensation_8;
- dsp->x8_spatial_compensation[9]=spatial_compensation_9;
- dsp->x8_spatial_compensation[10]=spatial_compensation_10;
- dsp->x8_spatial_compensation[11]=spatial_compensation_11;
+av_cold void ff_intrax8dsp_init(IntraX8DSPContext *dsp)
+{
+ dsp->h_loop_filter=x8_h_loop_filter;
+ dsp->v_loop_filter=x8_v_loop_filter;
+ dsp->setup_spatial_compensation=x8_setup_spatial_compensation;
+ dsp->spatial_compensation[0]=spatial_compensation_0;
+ dsp->spatial_compensation[1]=spatial_compensation_1;
+ dsp->spatial_compensation[2]=spatial_compensation_2;
+ dsp->spatial_compensation[3]=spatial_compensation_3;
+ dsp->spatial_compensation[4]=spatial_compensation_4;
+ dsp->spatial_compensation[5]=spatial_compensation_5;
+ dsp->spatial_compensation[6]=spatial_compensation_6;
+ dsp->spatial_compensation[7]=spatial_compensation_7;
+ dsp->spatial_compensation[8]=spatial_compensation_8;
+ dsp->spatial_compensation[9]=spatial_compensation_9;
+ dsp->spatial_compensation[10]=spatial_compensation_10;
+ dsp->spatial_compensation[11]=spatial_compensation_11;
}
diff --git a/libavcodec/intrax8dsp.h b/libavcodec/intrax8dsp.h
new file mode 100644
index 0000000..d67fa4e
--- /dev/null
+++ b/libavcodec/intrax8dsp.h
@@ -0,0 +1,33 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_INTRAX8DSP_H
+#define AVCODEC_INTRAX8DSP_H
+
+typedef struct IntraX8DSPContext {
+ void (*v_loop_filter)(uint8_t *src, int stride, int qscale);
+ void (*h_loop_filter)(uint8_t *src, int stride, int qscale);
+
+ void (*spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize);
+ void (*setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize,
+ int *range, int *sum, int edges);
+} IntraX8DSPContext;
+
+void ff_intrax8dsp_init(IntraX8DSPContext *dsp);
+
+#endif /* AVCODEC_INTRAX8DSP_H */
More information about the ffmpeg-cvslog
mailing list