Originally committed as revision 24685 to svn://svn.ffmpeg.org/ffmpeg/trunktags/n0.8
@@ -113,22 +113,22 @@ void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) { | |||
if(h->flags & A_AVAIL) { | |||
qp_avg = (h->qp + h->left_qp + 1) >> 1; | |||
SET_PARAMS; | |||
h->s.dsp.cavs_filter_lv(h->cy,h->l_stride,alpha,beta,tc,bs[0],bs[1]); | |||
h->s.dsp.cavs_filter_cv(h->cu,h->c_stride,alpha,beta,tc,bs[0],bs[1]); | |||
h->s.dsp.cavs_filter_cv(h->cv,h->c_stride,alpha,beta,tc,bs[0],bs[1]); | |||
h->cdsp.cavs_filter_lv(h->cy,h->l_stride,alpha,beta,tc,bs[0],bs[1]); | |||
h->cdsp.cavs_filter_cv(h->cu,h->c_stride,alpha,beta,tc,bs[0],bs[1]); | |||
h->cdsp.cavs_filter_cv(h->cv,h->c_stride,alpha,beta,tc,bs[0],bs[1]); | |||
} | |||
qp_avg = h->qp; | |||
SET_PARAMS; | |||
h->s.dsp.cavs_filter_lv(h->cy + 8,h->l_stride,alpha,beta,tc,bs[2],bs[3]); | |||
h->s.dsp.cavs_filter_lh(h->cy + 8*h->l_stride,h->l_stride,alpha,beta,tc, | |||
h->cdsp.cavs_filter_lv(h->cy + 8,h->l_stride,alpha,beta,tc,bs[2],bs[3]); | |||
h->cdsp.cavs_filter_lh(h->cy + 8*h->l_stride,h->l_stride,alpha,beta,tc, | |||
bs[6],bs[7]); | |||
if(h->flags & B_AVAIL) { | |||
qp_avg = (h->qp + h->top_qp[h->mbx] + 1) >> 1; | |||
SET_PARAMS; | |||
h->s.dsp.cavs_filter_lh(h->cy,h->l_stride,alpha,beta,tc,bs[4],bs[5]); | |||
h->s.dsp.cavs_filter_ch(h->cu,h->c_stride,alpha,beta,tc,bs[4],bs[5]); | |||
h->s.dsp.cavs_filter_ch(h->cv,h->c_stride,alpha,beta,tc,bs[4],bs[5]); | |||
h->cdsp.cavs_filter_lh(h->cy,h->l_stride,alpha,beta,tc,bs[4],bs[5]); | |||
h->cdsp.cavs_filter_ch(h->cu,h->c_stride,alpha,beta,tc,bs[4],bs[5]); | |||
h->cdsp.cavs_filter_ch(h->cv,h->c_stride,alpha,beta,tc,bs[4],bs[5]); | |||
} | |||
} | |||
} | |||
@@ -414,30 +414,30 @@ static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int de | |||
void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type) { | |||
if(ff_cavs_partition_flags[mb_type] == 0){ // 16x16 | |||
mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0, | |||
h->s.dsp.put_cavs_qpel_pixels_tab[0], | |||
h->cdsp.put_cavs_qpel_pixels_tab[0], | |||
h->s.dsp.put_h264_chroma_pixels_tab[0], | |||
h->s.dsp.avg_cavs_qpel_pixels_tab[0], | |||
h->cdsp.avg_cavs_qpel_pixels_tab[0], | |||
h->s.dsp.avg_h264_chroma_pixels_tab[0],&h->mv[MV_FWD_X0]); | |||
}else{ | |||
mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 0, | |||
h->s.dsp.put_cavs_qpel_pixels_tab[1], | |||
h->cdsp.put_cavs_qpel_pixels_tab[1], | |||
h->s.dsp.put_h264_chroma_pixels_tab[1], | |||
h->s.dsp.avg_cavs_qpel_pixels_tab[1], | |||
h->cdsp.avg_cavs_qpel_pixels_tab[1], | |||
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X0]); | |||
mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 0, | |||
h->s.dsp.put_cavs_qpel_pixels_tab[1], | |||
h->cdsp.put_cavs_qpel_pixels_tab[1], | |||
h->s.dsp.put_h264_chroma_pixels_tab[1], | |||
h->s.dsp.avg_cavs_qpel_pixels_tab[1], | |||
h->cdsp.avg_cavs_qpel_pixels_tab[1], | |||
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X1]); | |||
mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 4, | |||
h->s.dsp.put_cavs_qpel_pixels_tab[1], | |||
h->cdsp.put_cavs_qpel_pixels_tab[1], | |||
h->s.dsp.put_h264_chroma_pixels_tab[1], | |||
h->s.dsp.avg_cavs_qpel_pixels_tab[1], | |||
h->cdsp.avg_cavs_qpel_pixels_tab[1], | |||
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X2]); | |||
mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 4, | |||
h->s.dsp.put_cavs_qpel_pixels_tab[1], | |||
h->cdsp.put_cavs_qpel_pixels_tab[1], | |||
h->s.dsp.put_h264_chroma_pixels_tab[1], | |||
h->s.dsp.avg_cavs_qpel_pixels_tab[1], | |||
h->cdsp.avg_cavs_qpel_pixels_tab[1], | |||
h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X3]); | |||
} | |||
} | |||
@@ -672,6 +672,7 @@ av_cold int ff_cavs_init(AVCodecContext *avctx) { | |||
MpegEncContext * const s = &h->s; | |||
MPV_decode_defaults(s); | |||
ff_cavsdsp_init(&h->cdsp, avctx); | |||
s->avctx = avctx; | |||
avctx->pix_fmt= PIX_FMT_YUV420P; | |||
@@ -24,6 +24,7 @@ | |||
#include "dsputil.h" | |||
#include "mpegvideo.h" | |||
#include "cavsdsp.h" | |||
#define SLICE_MAX_START_CODE 0x000001af | |||
#define EXT_START_CODE 0x000001b5 | |||
@@ -153,6 +154,7 @@ struct dec_2dvlc { | |||
typedef struct { | |||
MpegEncContext s; | |||
CAVSDSPContext cdsp; | |||
Picture picture; ///< currently decoded frame | |||
Picture DPB[2]; ///< reference frames | |||
int dist[2]; ///< temporal distances from current frame to ref frames | |||
@@ -143,7 +143,7 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb, | |||
if(dequant(h,level_buf, run_buf, block, ff_cavs_dequant_mul[qp], | |||
ff_cavs_dequant_shift[qp], i)) | |||
return -1; | |||
h->s.dsp.cavs_idct8_add(dst,block,stride); | |||
h->cdsp.cavs_idct8_add(dst,block,stride); | |||
h->s.dsp.clear_block(block); | |||
return 0; | |||
} | |||
@@ -24,6 +24,7 @@ | |||
#include <stdio.h> | |||
#include "dsputil.h" | |||
#include "cavsdsp.h" | |||
/***************************************************************************** | |||
* | |||
@@ -510,7 +511,7 @@ CAVS_MC(put_, 16) | |||
CAVS_MC(avg_, 8) | |||
CAVS_MC(avg_, 16) | |||
av_cold void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx) { | |||
av_cold void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx) { | |||
#define dspfunc(PFX, IDX, NUM) \ | |||
c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_c; \ | |||
c->PFX ## _pixels_tab[IDX][ 1] = ff_ ## PFX ## NUM ## _mc10_c; \ | |||
@@ -537,4 +538,6 @@ av_cold void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx) { | |||
c->cavs_filter_cv = cavs_filter_cv_c; | |||
c->cavs_filter_ch = cavs_filter_ch_c; | |||
c->cavs_idct8_add = cavs_idct8_add_c; | |||
if (HAVE_MMX) ff_cavsdsp_init_mmx(c, avctx); | |||
} |
@@ -0,0 +1,41 @@ | |||
/* | |||
* Chinese AVS video (AVS1-P2, JiZhun profile) decoder. | |||
* Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> | |||
* | |||
* 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_CAVSDSP_H | |||
#define AVCODEC_CAVSDSP_H | |||
#include <stdint.h> | |||
#include "dsputil.h" | |||
typedef struct CAVSDSPContext { | |||
qpel_mc_func put_cavs_qpel_pixels_tab[2][16]; | |||
qpel_mc_func avg_cavs_qpel_pixels_tab[2][16]; | |||
void (*cavs_filter_lv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); | |||
void (*cavs_filter_lh)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); | |||
void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); | |||
void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); | |||
void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride); | |||
} CAVSDSPContext; | |||
void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx); | |||
void ff_cavsdsp_init_mmx(CAVSDSPContext* c, AVCodecContext *avctx); | |||
#endif |
@@ -4343,10 +4343,6 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) | |||
c->draw_edges = draw_edges_c; | |||
#if CONFIG_CAVS_DECODER | |||
ff_cavsdsp_init(c,avctx); | |||
#endif | |||
#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER | |||
ff_mlp_init(c, avctx); | |||
#endif | |||
@@ -339,15 +339,6 @@ typedef struct DSPContext { | |||
qpel_mc_func put_2tap_qpel_pixels_tab[4][16]; | |||
qpel_mc_func avg_2tap_qpel_pixels_tab[4][16]; | |||
/* AVS specific */ | |||
qpel_mc_func put_cavs_qpel_pixels_tab[2][16]; | |||
qpel_mc_func avg_cavs_qpel_pixels_tab[2][16]; | |||
void (*cavs_filter_lv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); | |||
void (*cavs_filter_lh)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); | |||
void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); | |||
void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); | |||
void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride); | |||
me_cmp_func pix_abs[2][4]; | |||
/* huffyuv specific */ | |||
@@ -640,7 +631,6 @@ void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx); | |||
void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); | |||
void ff_dsputil_init_dwt(DSPContext *c); | |||
void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx); | |||
void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx); | |||
void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx); | |||
void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx); | |||
@@ -25,6 +25,7 @@ | |||
#include "libavutil/common.h" | |||
#include "libavutil/x86_cpu.h" | |||
#include "libavcodec/dsputil.h" | |||
#include "libavcodec/cavsdsp.h" | |||
#include "dsputil_mmx.h" | |||
/***************************************************************************** | |||
@@ -437,7 +438,7 @@ CAVS_MC(put_, 16,mmx2) | |||
CAVS_MC(avg_, 8, mmx2) | |||
CAVS_MC(avg_, 16,mmx2) | |||
void ff_cavsdsp_init_mmx2(DSPContext* c, AVCodecContext *avctx) { | |||
static void ff_cavsdsp_init_mmx2(CAVSDSPContext* c, AVCodecContext *avctx) { | |||
#define dspfunc(PFX, IDX, NUM) \ | |||
c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmx2; \ | |||
c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_mmx2; \ | |||
@@ -453,7 +454,7 @@ void ff_cavsdsp_init_mmx2(DSPContext* c, AVCodecContext *avctx) { | |||
c->cavs_idct8_add = cavs_idct8_add_mmx; | |||
} | |||
void ff_cavsdsp_init_3dnow(DSPContext* c, AVCodecContext *avctx) { | |||
static void ff_cavsdsp_init_3dnow(CAVSDSPContext* c, AVCodecContext *avctx) { | |||
#define dspfunc(PFX, IDX, NUM) \ | |||
c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmx2; \ | |||
c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_3dnow; \ | |||
@@ -468,3 +469,11 @@ void ff_cavsdsp_init_3dnow(DSPContext* c, AVCodecContext *avctx) { | |||
#undef dspfunc | |||
c->cavs_idct8_add = cavs_idct8_add_mmx; | |||
} | |||
void ff_cavsdsp_init_mmx(CAVSDSPContext *c, AVCodecContext *avctx) | |||
{ | |||
int mm_flags = mm_support(); | |||
if (mm_flags & FF_MM_MMX2) ff_cavsdsp_init_mmx2 (c, avctx); | |||
if (mm_flags & FF_MM_3DNOW) ff_cavsdsp_init_3dnow(c, avctx); | |||
} |
@@ -2727,9 +2727,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) | |||
c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov; | |||
#endif | |||
if (CONFIG_CAVS_DECODER) | |||
ff_cavsdsp_init_mmx2(c, avctx); | |||
if (CONFIG_VC1_DECODER) | |||
ff_vc1dsp_init_mmx(c, avctx); | |||
@@ -2790,9 +2787,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) | |||
c->avg_rv40_chroma_pixels_tab[0]= avg_rv40_chroma_mc8_3dnow; | |||
c->avg_rv40_chroma_pixels_tab[1]= avg_rv40_chroma_mc4_3dnow; | |||
if (CONFIG_CAVS_DECODER) | |||
ff_cavsdsp_init_3dnow(c, avctx); | |||
} | |||
@@ -162,8 +162,6 @@ void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size | |||
void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size); | |||
void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size); | |||
void ff_cavsdsp_init_mmx2(DSPContext* c, AVCodecContext *avctx); | |||
void ff_cavsdsp_init_3dnow(DSPContext* c, AVCodecContext *avctx); | |||
void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); | |||
void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); | |||
void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride); | |||