Mercurial > libavcodec.hg
changeset 3395:adccbf4a1040 libavcodec
CAVS decoder by (Stefan Gehrer stefan.gehrer gmx.de)
author | michael |
---|---|
date | Mon, 03 Jul 2006 00:16:45 +0000 |
parents | 2b5283c15310 |
children | 3f43459705a5 |
files | Makefile allcodecs.c cavs.c cavsdata.h cavsdsp.c cavsdsp.h dsputil.c dsputil.h parser.c |
diffstat | 9 files changed, 161 insertions(+), 166 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Sun Jul 02 22:01:31 2006 +0000 +++ b/Makefile Mon Jul 03 00:16:45 2006 +0000 @@ -32,6 +32,9 @@ ifeq ($(CONFIG_AVS_DECODER),yes) OBJS+= avs.o endif +ifeq ($(CONFIG_CAVS_DECODER),yes) + OBJS+= cavs.o cavsdsp.o +endif ifeq ($(CONFIG_CINEPAK_DECODER),yes) OBJS+= cinepak.o endif
--- a/allcodecs.c Sun Jul 02 22:01:31 2006 +0000 +++ b/allcodecs.c Mon Jul 03 00:16:45 2006 +0000 @@ -529,6 +529,9 @@ #ifdef CONFIG_AVS_DECODER register_avcodec(&avs_decoder); #endif //CONFIG_AVS_DECODER +#ifdef CONFIG_CAVS_DECODER + register_avcodec(&cavs_decoder); +#endif //CONFIG_CAVS_DECODER #ifdef CONFIG_RAWVIDEO_DECODER register_avcodec(&rawvideo_decoder); #endif //CONFIG_RAWVIDEO_DECODER @@ -637,6 +640,7 @@ /* parsers */ av_register_codec_parser(&mpegvideo_parser); av_register_codec_parser(&mpeg4video_parser); + av_register_codec_parser(&cavsvideo_parser); #if defined(CONFIG_H261_DECODER) || defined(CONFIG_H261_ENCODER) av_register_codec_parser(&h261_parser); #endif
--- a/cavs.c Sun Jul 02 22:01:31 2006 +0000 +++ b/cavs.c Mon Jul 03 00:16:45 2006 +0000 @@ -76,7 +76,7 @@ /* intra prediction is done with un-deblocked samples they are saved here before deblocking the MB */ uint8_t *top_border_y, *top_border_u, *top_border_v; - uint8_t left_border_y[16], left_border_u[8], left_border_v[8]; + uint8_t left_border_y[16], left_border_u[10], left_border_v[10]; uint8_t topleft_border_y, topleft_border_u, topleft_border_v; void (*intra_pred_l[8])(uint8_t *d,uint8_t *top,uint8_t *left,int stride); @@ -136,22 +136,22 @@ tc = tc_tab[clip(qp_avg + h->alpha_offset,0,63)]; static void filter_mb(AVSContext *h, enum mb_t mb_type) { - uint8_t bs[8]; + DECLARE_ALIGNED_8(uint8_t, bs[8]); int qp_avg, alpha, beta, tc; int i; /* save un-deblocked lines */ h->topleft_border_y = h->top_border_y[h->mbx*16+15]; - h->topleft_border_u = h->top_border_u[h->mbx*8+7]; - h->topleft_border_v = h->top_border_v[h->mbx*8+7]; + h->topleft_border_u = h->top_border_u[h->mbx*10+8]; + h->topleft_border_v = h->top_border_v[h->mbx*10+8]; memcpy(&h->top_border_y[h->mbx*16], h->cy + 15* h->l_stride,16); - memcpy(&h->top_border_u[h->mbx* 8], h->cu + 7* h->c_stride,8); - memcpy(&h->top_border_v[h->mbx* 8], h->cv + 7* h->c_stride,8); + memcpy(&h->top_border_u[h->mbx*10+1], h->cu + 7* h->c_stride,8); + memcpy(&h->top_border_v[h->mbx*10+1], h->cv + 7* h->c_stride,8); for(i=0;i<8;i++) { h->left_border_y[i*2+0] = *(h->cy + 15 + (i*2+0)*h->l_stride); h->left_border_y[i*2+1] = *(h->cy + 15 + (i*2+1)*h->l_stride); - h->left_border_u[i] = *(h->cu + 7 + i*h->c_stride); - h->left_border_v[i] = *(h->cv + 7 + i*h->c_stride); + h->left_border_u[i+1] = *(h->cu + 7 + i*h->c_stride); + h->left_border_v[i+1] = *(h->cv + 7 + i*h->c_stride); } if(!h->loop_filter_disable) { /* clear bs */ @@ -286,27 +286,6 @@ } } -static inline void load_intra_pred_chroma(uint8_t *stop, uint8_t *sleft, - uint8_t stopleft, uint8_t *dtop, - uint8_t *dleft, int stride, int flags) { - int i; - - if(flags & A_AVAIL) { - for(i=0; i<8; i++) - dleft[i+1] = sleft[i]; - dleft[0] = dleft[1]; - dleft[9] = dleft[8]; - } - if(flags & B_AVAIL) { - for(i=0; i<8; i++) - dtop[i+1] = stop[i]; - dtop[0] = dtop[1]; - dtop[9] = dtop[8]; - if(flags & A_AVAIL) - dleft[0] = dtop[0] = stopleft; - } -} - static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int y; uint64_t a = *((uint64_t *)(&top[1])); @@ -394,7 +373,7 @@ #undef LOWPASS -static inline void modify_pred(const int8_t *mod_table, int *mode) { +static inline void modify_pred(const int_fast8_t *mod_table, int *mode) { int newmode = mod_table[*mode]; if(newmode < 0) { av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n"); @@ -688,8 +667,10 @@ /* kth-order exponential golomb code */ static inline int get_ue_code(GetBitContext *gb, int order) { - if(order) - return (get_ue_golomb(gb) << order) + get_bits(gb,order); + if(order) { + int ret = get_ue_golomb(gb) << order; + return ret + get_bits(gb,order); + } return get_ue_golomb(gb); } @@ -730,7 +711,7 @@ run_buf[i] = run; } /* inverse scan and dequantization */ - for(i=i-1;i>=0;i--) { + while(--i >= 0){ pos += 1 + run_buf[i]; if(pos > 63) { av_log(h->s.avctx, AV_LOG_ERROR, @@ -920,12 +901,24 @@ } /* chroma intra prediction */ - load_intra_pred_chroma(&h->top_border_u[h->mbx*8], h->left_border_u, - h->topleft_border_u, top, left, h->c_stride, h->flags); - h->intra_pred_c[pred_mode_uv](h->cu, top, left, h->c_stride); - load_intra_pred_chroma(&h->top_border_v[h->mbx*8], h->left_border_v, - h->topleft_border_v, top, left, h->c_stride, h->flags); - h->intra_pred_c[pred_mode_uv](h->cv, top, left, h->c_stride); + /* extend borders by one pixel */ + h->left_border_u[9] = h->left_border_u[8]; + h->left_border_v[9] = h->left_border_v[8]; + h->top_border_u[h->mbx*10+9] = h->top_border_u[h->mbx*10+8]; + h->top_border_v[h->mbx*10+9] = h->top_border_v[h->mbx*10+8]; + if(h->mbx && h->mby) { + h->top_border_u[h->mbx*10] = h->left_border_u[0] = h->topleft_border_u; + h->top_border_v[h->mbx*10] = h->left_border_v[0] = h->topleft_border_v; + } else { + h->left_border_u[0] = h->left_border_u[1]; + h->left_border_v[0] = h->left_border_v[1]; + h->top_border_u[h->mbx*10] = h->top_border_u[h->mbx*10+1]; + h->top_border_v[h->mbx*10] = h->top_border_v[h->mbx*10+1]; + } + h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx*10], + h->left_border_u, h->c_stride); + h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10], + h->left_border_v, h->c_stride); decode_residual_chroma(h); filter_mb(h,I_8X8); @@ -1324,10 +1317,10 @@ h->top_qp = av_malloc( h->mb_width); h->top_mv[0] = av_malloc((h->mb_width*2+1)*sizeof(vector_t)); h->top_mv[1] = av_malloc((h->mb_width*2+1)*sizeof(vector_t)); - h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(int)); + h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y)); h->top_border_y = av_malloc((h->mb_width+1)*16); - h->top_border_u = av_malloc((h->mb_width+1)*8); - h->top_border_v = av_malloc((h->mb_width+1)*8); + h->top_border_u = av_malloc((h->mb_width)*10); + h->top_border_v = av_malloc((h->mb_width)*10); /* alloc space for co-located MVs and types */ h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(vector_t)); @@ -1336,7 +1329,7 @@ static int decode_seq_header(AVSContext *h) { MpegEncContext *s = &h->s; - extern const AVRational frame_rate_tab[]; + extern const AVRational ff_frame_rate_tab[]; int frame_rate_code; h->profile = get_bits(&s->gb,8); @@ -1354,8 +1347,8 @@ s->low_delay = get_bits1(&s->gb); h->mb_width = (s->width + 15) >> 4; h->mb_height = (s->height + 15) >> 4; - h->s.avctx->time_base.den = frame_rate_tab[frame_rate_code].num; - h->s.avctx->time_base.num = frame_rate_tab[frame_rate_code].den; + h->s.avctx->time_base.den = ff_frame_rate_tab[frame_rate_code].num; + h->s.avctx->time_base.num = ff_frame_rate_tab[frame_rate_code].den; h->s.avctx->width = s->width; h->s.avctx->height = s->height; if(!h->top_qp) @@ -1541,6 +1534,6 @@ NULL, cavs_decode_end, cavs_decode_frame, - CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY, //FIXME is this correct ? + CODEC_CAP_DR1 | CODEC_CAP_DELAY, .flush= ff_cavs_flush, };
--- a/cavsdata.h Sun Jul 02 22:01:31 2006 +0000 +++ b/cavsdata.h Mon Jul 03 00:16:45 2006 +0000 @@ -187,7 +187,7 @@ 32771,35734,38965,42497,46341,50535,55109,60099 }; -typedef struct { +DECLARE_ALIGNED_8(typedef, struct) { int16_t x; int16_t y; int16_t dist;
--- a/cavsdsp.c Sun Jul 02 22:01:31 2006 +0000 +++ b/cavsdsp.c Mon Jul 03 00:16:45 2006 +0000 @@ -22,7 +22,6 @@ #include <stdio.h> #include "dsputil.h" -#include "cavsdsp.h" /***************************************************************************** * @@ -110,7 +109,7 @@ #undef Q1 #undef Q2 -void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc, +static void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2) { int i; if(bs1==2) @@ -126,7 +125,7 @@ } } -void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc, +static void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2) { int i; if(bs1==2) @@ -142,7 +141,7 @@ } } -void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc, +static void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2) { int i; if(bs1==2) @@ -158,7 +157,7 @@ } } -void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc, +static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2) { int i; if(bs1==2) @@ -180,7 +179,7 @@ * ****************************************************************************/ -void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) { +static void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) { int i; DCTELEM (*src)[8] = (DCTELEM(*)[8])block; uint8_t *cm = cropTbl + MAX_NEG_CROP; @@ -416,66 +415,63 @@ }\ #define CAVS_MC(OPNAME, SIZE) \ -void OPNAME ## cavs_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\ - OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\ -}\ -void OPNAME ## cavs_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _h_qpel_l(dst, src, stride, stride);\ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _h_hpel(dst, src, stride, stride);\ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _h_qpel_r(dst, src, stride, stride);\ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _v_qpel_l(dst, src, stride, stride);\ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _v_hpel(dst, src, stride, stride);\ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _v_qpel_r(dst, src, stride, stride);\ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _hv_jj(dst, src, NULL, stride, stride); \ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src, stride, stride); \ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride, stride, stride); \ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+1, stride, stride); \ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride+1,stride, stride); \ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _hv_ff(dst, src, src+stride+1,stride, stride); \ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _hv_ii(dst, src, src+stride+1,stride, stride); \ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _hv_kk(dst, src, src+stride+1,stride, stride); \ }\ \ -void OPNAME ## cavs_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\ +static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\ OPNAME ## cavs_filt ## SIZE ## _hv_qq(dst, src, src+stride+1,stride, stride); \ }\ @@ -509,3 +505,37 @@ CAVS_MC(put_, 16) CAVS_MC(avg_, 8) CAVS_MC(avg_, 16) + +void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); +void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); +void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); +void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); + +void ff_cavsdsp_init(DSPContext* 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; \ + c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_c; \ + c->PFX ## _pixels_tab[IDX][ 3] = ff_ ## PFX ## NUM ## _mc30_c; \ + c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_c; \ + c->PFX ## _pixels_tab[IDX][ 5] = ff_ ## PFX ## NUM ## _mc11_c; \ + c->PFX ## _pixels_tab[IDX][ 6] = ff_ ## PFX ## NUM ## _mc21_c; \ + c->PFX ## _pixels_tab[IDX][ 7] = ff_ ## PFX ## NUM ## _mc31_c; \ + c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_c; \ + c->PFX ## _pixels_tab[IDX][ 9] = ff_ ## PFX ## NUM ## _mc12_c; \ + c->PFX ## _pixels_tab[IDX][10] = ff_ ## PFX ## NUM ## _mc22_c; \ + c->PFX ## _pixels_tab[IDX][11] = ff_ ## PFX ## NUM ## _mc32_c; \ + c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_c; \ + c->PFX ## _pixels_tab[IDX][13] = ff_ ## PFX ## NUM ## _mc13_c; \ + c->PFX ## _pixels_tab[IDX][14] = ff_ ## PFX ## NUM ## _mc23_c; \ + c->PFX ## _pixels_tab[IDX][15] = ff_ ## PFX ## NUM ## _mc33_c + dspfunc(put_cavs_qpel, 0, 16); + dspfunc(put_cavs_qpel, 1, 8); + dspfunc(avg_cavs_qpel, 0, 16); + dspfunc(avg_cavs_qpel, 1, 8); + c->cavs_filter_lv = cavs_filter_lv_c; + c->cavs_filter_lh = cavs_filter_lh_c; + c->cavs_filter_cv = cavs_filter_cv_c; + c->cavs_filter_ch = cavs_filter_ch_c; + c->cavs_idct8_add = cavs_idct8_add_c; +}
--- a/cavsdsp.h Sun Jul 02 22:01:31 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. - * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> - * - * DSP function prototypes - * - * This library 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 of the License, or (at your option) any later version. - * - * This library 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 this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -void put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride); -void put_cavs_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride); -void avg_cavs_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride); -void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2); -void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2); -void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2); -void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2); -void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride); - -void put_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h); -void put_pixels16_c(uint8_t *block, const uint8_t *pixels, int line_size, int h); -void avg_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h); -void avg_pixels16_c(uint8_t *block, const uint8_t *pixels, int line_size, int h);
--- a/dsputil.c Sun Jul 02 22:01:31 2006 +0000 +++ b/dsputil.c Mon Jul 03 00:16:45 2006 +0000 @@ -2570,6 +2570,22 @@ } } +/* AVS specific */ +void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx); + +void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) { + put_pixels8_c(dst, src, stride, 8); +} +void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) { + avg_pixels8_c(dst, src, stride, 8); +} +void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) { + put_pixels16_c(dst, src, stride, 16); +} +void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) { + avg_pixels16_c(dst, src, stride, 16); +} + static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){ uint8_t *cm = cropTbl + MAX_NEG_CROP; int i; @@ -3989,6 +4005,8 @@ c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c; c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c; + ff_cavsdsp_init(c,avctx); + c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c; c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
--- a/dsputil.h Sun Jul 02 22:01:31 2006 +0000 +++ b/dsputil.h Mon Jul 03 00:16:45 2006 +0000 @@ -274,6 +274,15 @@ h264_weight_func weight_h264_pixels_tab[10]; h264_biweight_func biweight_h264_pixels_tab[10]; + /* 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 */
--- a/parser.c Sun Jul 02 22:01:31 2006 +0000 +++ b/parser.c Mon Jul 03 00:16:45 2006 +0000 @@ -533,6 +533,30 @@ return next; } +static int cavsvideo_parse(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size) +{ + ParseContext *pc = s->priv_data; + int next; + + if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ + next= buf_size; + }else{ + next= ff_cavs_find_frame_end(pc, buf, buf_size); + + if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { + *poutbuf = NULL; + *poutbuf_size = 0; + return buf_size; + } + } + *poutbuf = (uint8_t *)buf; + *poutbuf_size = buf_size; + return next; +} + static int mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { @@ -987,6 +1011,15 @@ mpeg4video_split, }; +AVCodecParser cavsvideo_parser = { + { CODEC_ID_CAVS }, + sizeof(ParseContext1), + NULL, + cavsvideo_parse, + parse1_close, + mpeg4video_split, +}; + AVCodecParser mpegaudio_parser = { { CODEC_ID_MP2, CODEC_ID_MP3 }, sizeof(MpegAudioParseContext),