Originally committed as revision 5590 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -529,6 +529,9 @@ void avcodec_register_all(void) |
| 529 | 529 |
#ifdef CONFIG_AVS_DECODER |
| 530 | 530 |
register_avcodec(&avs_decoder); |
| 531 | 531 |
#endif //CONFIG_AVS_DECODER |
| 532 |
+#ifdef CONFIG_CAVS_DECODER |
|
| 533 |
+ register_avcodec(&cavs_decoder); |
|
| 534 |
+#endif //CONFIG_CAVS_DECODER |
|
| 532 | 535 |
#ifdef CONFIG_RAWVIDEO_DECODER |
| 533 | 536 |
register_avcodec(&rawvideo_decoder); |
| 534 | 537 |
#endif //CONFIG_RAWVIDEO_DECODER |
| ... | ... |
@@ -637,6 +640,7 @@ PCM_CODEC(CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2); |
| 637 | 637 |
/* parsers */ |
| 638 | 638 |
av_register_codec_parser(&mpegvideo_parser); |
| 639 | 639 |
av_register_codec_parser(&mpeg4video_parser); |
| 640 |
+ av_register_codec_parser(&cavsvideo_parser); |
|
| 640 | 641 |
#if defined(CONFIG_H261_DECODER) || defined(CONFIG_H261_ENCODER) |
| 641 | 642 |
av_register_codec_parser(&h261_parser); |
| 642 | 643 |
#endif |
| ... | ... |
@@ -76,7 +76,7 @@ typedef struct {
|
| 76 | 76 |
/* intra prediction is done with un-deblocked samples |
| 77 | 77 |
they are saved here before deblocking the MB */ |
| 78 | 78 |
uint8_t *top_border_y, *top_border_u, *top_border_v; |
| 79 |
- uint8_t left_border_y[16], left_border_u[8], left_border_v[8]; |
|
| 79 |
+ uint8_t left_border_y[16], left_border_u[10], left_border_v[10]; |
|
| 80 | 80 |
uint8_t topleft_border_y, topleft_border_u, topleft_border_v; |
| 81 | 81 |
|
| 82 | 82 |
void (*intra_pred_l[8])(uint8_t *d,uint8_t *top,uint8_t *left,int stride); |
| ... | ... |
@@ -136,22 +136,22 @@ static inline int get_bs_b(vector_t *mvP, vector_t *mvQ) {
|
| 136 | 136 |
tc = tc_tab[clip(qp_avg + h->alpha_offset,0,63)]; |
| 137 | 137 |
|
| 138 | 138 |
static void filter_mb(AVSContext *h, enum mb_t mb_type) {
|
| 139 |
- uint8_t bs[8]; |
|
| 139 |
+ DECLARE_ALIGNED_8(uint8_t, bs[8]); |
|
| 140 | 140 |
int qp_avg, alpha, beta, tc; |
| 141 | 141 |
int i; |
| 142 | 142 |
|
| 143 | 143 |
/* save un-deblocked lines */ |
| 144 | 144 |
h->topleft_border_y = h->top_border_y[h->mbx*16+15]; |
| 145 |
- h->topleft_border_u = h->top_border_u[h->mbx*8+7]; |
|
| 146 |
- h->topleft_border_v = h->top_border_v[h->mbx*8+7]; |
|
| 145 |
+ h->topleft_border_u = h->top_border_u[h->mbx*10+8]; |
|
| 146 |
+ h->topleft_border_v = h->top_border_v[h->mbx*10+8]; |
|
| 147 | 147 |
memcpy(&h->top_border_y[h->mbx*16], h->cy + 15* h->l_stride,16); |
| 148 |
- memcpy(&h->top_border_u[h->mbx* 8], h->cu + 7* h->c_stride,8); |
|
| 149 |
- memcpy(&h->top_border_v[h->mbx* 8], h->cv + 7* h->c_stride,8); |
|
| 148 |
+ memcpy(&h->top_border_u[h->mbx*10+1], h->cu + 7* h->c_stride,8); |
|
| 149 |
+ memcpy(&h->top_border_v[h->mbx*10+1], h->cv + 7* h->c_stride,8); |
|
| 150 | 150 |
for(i=0;i<8;i++) {
|
| 151 | 151 |
h->left_border_y[i*2+0] = *(h->cy + 15 + (i*2+0)*h->l_stride); |
| 152 | 152 |
h->left_border_y[i*2+1] = *(h->cy + 15 + (i*2+1)*h->l_stride); |
| 153 |
- h->left_border_u[i] = *(h->cu + 7 + i*h->c_stride); |
|
| 154 |
- h->left_border_v[i] = *(h->cv + 7 + i*h->c_stride); |
|
| 153 |
+ h->left_border_u[i+1] = *(h->cu + 7 + i*h->c_stride); |
|
| 154 |
+ h->left_border_v[i+1] = *(h->cv + 7 + i*h->c_stride); |
|
| 155 | 155 |
} |
| 156 | 156 |
if(!h->loop_filter_disable) {
|
| 157 | 157 |
/* clear bs */ |
| ... | ... |
@@ -286,27 +286,6 @@ static inline void load_intra_pred_luma(AVSContext *h, uint8_t *top, |
| 286 | 286 |
} |
| 287 | 287 |
} |
| 288 | 288 |
|
| 289 |
-static inline void load_intra_pred_chroma(uint8_t *stop, uint8_t *sleft, |
|
| 290 |
- uint8_t stopleft, uint8_t *dtop, |
|
| 291 |
- uint8_t *dleft, int stride, int flags) {
|
|
| 292 |
- int i; |
|
| 293 |
- |
|
| 294 |
- if(flags & A_AVAIL) {
|
|
| 295 |
- for(i=0; i<8; i++) |
|
| 296 |
- dleft[i+1] = sleft[i]; |
|
| 297 |
- dleft[0] = dleft[1]; |
|
| 298 |
- dleft[9] = dleft[8]; |
|
| 299 |
- } |
|
| 300 |
- if(flags & B_AVAIL) {
|
|
| 301 |
- for(i=0; i<8; i++) |
|
| 302 |
- dtop[i+1] = stop[i]; |
|
| 303 |
- dtop[0] = dtop[1]; |
|
| 304 |
- dtop[9] = dtop[8]; |
|
| 305 |
- if(flags & A_AVAIL) |
|
| 306 |
- dleft[0] = dtop[0] = stopleft; |
|
| 307 |
- } |
|
| 308 |
-} |
|
| 309 |
- |
|
| 310 | 289 |
static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
|
| 311 | 290 |
int y; |
| 312 | 291 |
uint64_t a = *((uint64_t *)(&top[1])); |
| ... | ... |
@@ -394,7 +373,7 @@ static void intra_pred_lp_top(uint8_t *d,uint8_t *top,uint8_t *left,int stride) |
| 394 | 394 |
|
| 395 | 395 |
#undef LOWPASS |
| 396 | 396 |
|
| 397 |
-static inline void modify_pred(const int8_t *mod_table, int *mode) {
|
|
| 397 |
+static inline void modify_pred(const int_fast8_t *mod_table, int *mode) {
|
|
| 398 | 398 |
int newmode = mod_table[*mode]; |
| 399 | 399 |
if(newmode < 0) {
|
| 400 | 400 |
av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n"); |
| ... | ... |
@@ -688,8 +667,10 @@ static void mv_pred(AVSContext *h, enum mv_loc_t nP, enum mv_loc_t nC, |
| 688 | 688 |
|
| 689 | 689 |
/* kth-order exponential golomb code */ |
| 690 | 690 |
static inline int get_ue_code(GetBitContext *gb, int order) {
|
| 691 |
- if(order) |
|
| 692 |
- return (get_ue_golomb(gb) << order) + get_bits(gb,order); |
|
| 691 |
+ if(order) {
|
|
| 692 |
+ int ret = get_ue_golomb(gb) << order; |
|
| 693 |
+ return ret + get_bits(gb,order); |
|
| 694 |
+ } |
|
| 693 | 695 |
return get_ue_golomb(gb); |
| 694 | 696 |
} |
| 695 | 697 |
|
| ... | ... |
@@ -730,7 +711,7 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb, |
| 730 | 730 |
run_buf[i] = run; |
| 731 | 731 |
} |
| 732 | 732 |
/* inverse scan and dequantization */ |
| 733 |
- for(i=i-1;i>=0;i--) {
|
|
| 733 |
+ while(--i >= 0){
|
|
| 734 | 734 |
pos += 1 + run_buf[i]; |
| 735 | 735 |
if(pos > 63) {
|
| 736 | 736 |
av_log(h->s.avctx, AV_LOG_ERROR, |
| ... | ... |
@@ -920,12 +901,24 @@ static void decode_mb_i(AVSContext *h, int is_i_pic) {
|
| 920 | 920 |
} |
| 921 | 921 |
|
| 922 | 922 |
/* chroma intra prediction */ |
| 923 |
- load_intra_pred_chroma(&h->top_border_u[h->mbx*8], h->left_border_u, |
|
| 924 |
- h->topleft_border_u, top, left, h->c_stride, h->flags); |
|
| 925 |
- h->intra_pred_c[pred_mode_uv](h->cu, top, left, h->c_stride); |
|
| 926 |
- load_intra_pred_chroma(&h->top_border_v[h->mbx*8], h->left_border_v, |
|
| 927 |
- h->topleft_border_v, top, left, h->c_stride, h->flags); |
|
| 928 |
- h->intra_pred_c[pred_mode_uv](h->cv, top, left, h->c_stride); |
|
| 923 |
+ /* extend borders by one pixel */ |
|
| 924 |
+ h->left_border_u[9] = h->left_border_u[8]; |
|
| 925 |
+ h->left_border_v[9] = h->left_border_v[8]; |
|
| 926 |
+ h->top_border_u[h->mbx*10+9] = h->top_border_u[h->mbx*10+8]; |
|
| 927 |
+ h->top_border_v[h->mbx*10+9] = h->top_border_v[h->mbx*10+8]; |
|
| 928 |
+ if(h->mbx && h->mby) {
|
|
| 929 |
+ h->top_border_u[h->mbx*10] = h->left_border_u[0] = h->topleft_border_u; |
|
| 930 |
+ h->top_border_v[h->mbx*10] = h->left_border_v[0] = h->topleft_border_v; |
|
| 931 |
+ } else {
|
|
| 932 |
+ h->left_border_u[0] = h->left_border_u[1]; |
|
| 933 |
+ h->left_border_v[0] = h->left_border_v[1]; |
|
| 934 |
+ h->top_border_u[h->mbx*10] = h->top_border_u[h->mbx*10+1]; |
|
| 935 |
+ h->top_border_v[h->mbx*10] = h->top_border_v[h->mbx*10+1]; |
|
| 936 |
+ } |
|
| 937 |
+ h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx*10], |
|
| 938 |
+ h->left_border_u, h->c_stride); |
|
| 939 |
+ h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10], |
|
| 940 |
+ h->left_border_v, h->c_stride); |
|
| 929 | 941 |
|
| 930 | 942 |
decode_residual_chroma(h); |
| 931 | 943 |
filter_mb(h,I_8X8); |
| ... | ... |
@@ -1324,10 +1317,10 @@ static void init_top_lines(AVSContext *h) {
|
| 1324 | 1324 |
h->top_qp = av_malloc( h->mb_width); |
| 1325 | 1325 |
h->top_mv[0] = av_malloc((h->mb_width*2+1)*sizeof(vector_t)); |
| 1326 | 1326 |
h->top_mv[1] = av_malloc((h->mb_width*2+1)*sizeof(vector_t)); |
| 1327 |
- h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(int)); |
|
| 1327 |
+ h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y)); |
|
| 1328 | 1328 |
h->top_border_y = av_malloc((h->mb_width+1)*16); |
| 1329 |
- h->top_border_u = av_malloc((h->mb_width+1)*8); |
|
| 1330 |
- h->top_border_v = av_malloc((h->mb_width+1)*8); |
|
| 1329 |
+ h->top_border_u = av_malloc((h->mb_width)*10); |
|
| 1330 |
+ h->top_border_v = av_malloc((h->mb_width)*10); |
|
| 1331 | 1331 |
|
| 1332 | 1332 |
/* alloc space for co-located MVs and types */ |
| 1333 | 1333 |
h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(vector_t)); |
| ... | ... |
@@ -1336,7 +1329,7 @@ static void init_top_lines(AVSContext *h) {
|
| 1336 | 1336 |
|
| 1337 | 1337 |
static int decode_seq_header(AVSContext *h) {
|
| 1338 | 1338 |
MpegEncContext *s = &h->s; |
| 1339 |
- extern const AVRational frame_rate_tab[]; |
|
| 1339 |
+ extern const AVRational ff_frame_rate_tab[]; |
|
| 1340 | 1340 |
int frame_rate_code; |
| 1341 | 1341 |
|
| 1342 | 1342 |
h->profile = get_bits(&s->gb,8); |
| ... | ... |
@@ -1354,8 +1347,8 @@ static int decode_seq_header(AVSContext *h) {
|
| 1354 | 1354 |
s->low_delay = get_bits1(&s->gb); |
| 1355 | 1355 |
h->mb_width = (s->width + 15) >> 4; |
| 1356 | 1356 |
h->mb_height = (s->height + 15) >> 4; |
| 1357 |
- h->s.avctx->time_base.den = frame_rate_tab[frame_rate_code].num; |
|
| 1358 |
- h->s.avctx->time_base.num = frame_rate_tab[frame_rate_code].den; |
|
| 1357 |
+ h->s.avctx->time_base.den = ff_frame_rate_tab[frame_rate_code].num; |
|
| 1358 |
+ h->s.avctx->time_base.num = ff_frame_rate_tab[frame_rate_code].den; |
|
| 1359 | 1359 |
h->s.avctx->width = s->width; |
| 1360 | 1360 |
h->s.avctx->height = s->height; |
| 1361 | 1361 |
if(!h->top_qp) |
| ... | ... |
@@ -1541,6 +1534,6 @@ AVCodec cavs_decoder = {
|
| 1541 | 1541 |
NULL, |
| 1542 | 1542 |
cavs_decode_end, |
| 1543 | 1543 |
cavs_decode_frame, |
| 1544 |
- CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY, //FIXME is this correct ? |
|
| 1544 |
+ CODEC_CAP_DR1 | CODEC_CAP_DELAY, |
|
| 1545 | 1545 |
.flush= ff_cavs_flush, |
| 1546 | 1546 |
}; |
| ... | ... |
@@ -22,7 +22,6 @@ |
| 22 | 22 |
|
| 23 | 23 |
#include <stdio.h> |
| 24 | 24 |
#include "dsputil.h" |
| 25 |
-#include "cavsdsp.h" |
|
| 26 | 25 |
|
| 27 | 26 |
/***************************************************************************** |
| 28 | 27 |
* |
| ... | ... |
@@ -110,7 +109,7 @@ static inline void loop_filter_c1(uint8_t *p0_p,int stride,int alpha, int beta, |
| 110 | 110 |
#undef Q1 |
| 111 | 111 |
#undef Q2 |
| 112 | 112 |
|
| 113 |
-void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
|
| 113 |
+static void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
|
| 114 | 114 |
int bs1, int bs2) {
|
| 115 | 115 |
int i; |
| 116 | 116 |
if(bs1==2) |
| ... | ... |
@@ -126,7 +125,7 @@ void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
| 126 | 126 |
} |
| 127 | 127 |
} |
| 128 | 128 |
|
| 129 |
-void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
|
| 129 |
+static void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
|
| 130 | 130 |
int bs1, int bs2) {
|
| 131 | 131 |
int i; |
| 132 | 132 |
if(bs1==2) |
| ... | ... |
@@ -142,7 +141,7 @@ void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
| 142 | 142 |
} |
| 143 | 143 |
} |
| 144 | 144 |
|
| 145 |
-void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
|
| 145 |
+static void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
|
| 146 | 146 |
int bs1, int bs2) {
|
| 147 | 147 |
int i; |
| 148 | 148 |
if(bs1==2) |
| ... | ... |
@@ -158,7 +157,7 @@ void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
| 158 | 158 |
} |
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 |
-void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
|
| 161 |
+static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
|
| 162 | 162 |
int bs1, int bs2) {
|
| 163 | 163 |
int i; |
| 164 | 164 |
if(bs1==2) |
| ... | ... |
@@ -180,7 +179,7 @@ void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc, |
| 180 | 180 |
* |
| 181 | 181 |
****************************************************************************/ |
| 182 | 182 |
|
| 183 |
-void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) {
|
|
| 183 |
+static void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) {
|
|
| 184 | 184 |
int i; |
| 185 | 185 |
DCTELEM (*src)[8] = (DCTELEM(*)[8])block; |
| 186 | 186 |
uint8_t *cm = cropTbl + MAX_NEG_CROP; |
| ... | ... |
@@ -416,66 +415,63 @@ static void OPNAME ## cavs_filt16_hv_ ## NAME(uint8_t *dst, uint8_t *src1, uint8 |
| 416 | 416 |
}\ |
| 417 | 417 |
|
| 418 | 418 |
#define CAVS_MC(OPNAME, SIZE) \ |
| 419 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\
|
|
| 420 |
- OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\ |
|
| 421 |
-}\ |
|
| 422 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 419 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 423 | 420 |
OPNAME ## cavs_filt ## SIZE ## _h_qpel_l(dst, src, stride, stride);\ |
| 424 | 421 |
}\ |
| 425 | 422 |
\ |
| 426 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 423 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 427 | 424 |
OPNAME ## cavs_filt ## SIZE ## _h_hpel(dst, src, stride, stride);\ |
| 428 | 425 |
}\ |
| 429 | 426 |
\ |
| 430 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 427 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 431 | 428 |
OPNAME ## cavs_filt ## SIZE ## _h_qpel_r(dst, src, stride, stride);\ |
| 432 | 429 |
}\ |
| 433 | 430 |
\ |
| 434 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 431 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 435 | 432 |
OPNAME ## cavs_filt ## SIZE ## _v_qpel_l(dst, src, stride, stride);\ |
| 436 | 433 |
}\ |
| 437 | 434 |
\ |
| 438 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 435 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 439 | 436 |
OPNAME ## cavs_filt ## SIZE ## _v_hpel(dst, src, stride, stride);\ |
| 440 | 437 |
}\ |
| 441 | 438 |
\ |
| 442 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 439 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 443 | 440 |
OPNAME ## cavs_filt ## SIZE ## _v_qpel_r(dst, src, stride, stride);\ |
| 444 | 441 |
}\ |
| 445 | 442 |
\ |
| 446 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 443 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 447 | 444 |
OPNAME ## cavs_filt ## SIZE ## _hv_jj(dst, src, NULL, stride, stride); \ |
| 448 | 445 |
}\ |
| 449 | 446 |
\ |
| 450 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 447 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 451 | 448 |
OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src, stride, stride); \ |
| 452 | 449 |
}\ |
| 453 | 450 |
\ |
| 454 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 451 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 455 | 452 |
OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride, stride, stride); \ |
| 456 | 453 |
}\ |
| 457 | 454 |
\ |
| 458 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 455 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 459 | 456 |
OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+1, stride, stride); \ |
| 460 | 457 |
}\ |
| 461 | 458 |
\ |
| 462 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 459 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 463 | 460 |
OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride+1,stride, stride); \ |
| 464 | 461 |
}\ |
| 465 | 462 |
\ |
| 466 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 463 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 467 | 464 |
OPNAME ## cavs_filt ## SIZE ## _hv_ff(dst, src, src+stride+1,stride, stride); \ |
| 468 | 465 |
}\ |
| 469 | 466 |
\ |
| 470 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 467 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 471 | 468 |
OPNAME ## cavs_filt ## SIZE ## _hv_ii(dst, src, src+stride+1,stride, stride); \ |
| 472 | 469 |
}\ |
| 473 | 470 |
\ |
| 474 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 471 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 475 | 472 |
OPNAME ## cavs_filt ## SIZE ## _hv_kk(dst, src, src+stride+1,stride, stride); \ |
| 476 | 473 |
}\ |
| 477 | 474 |
\ |
| 478 |
-void OPNAME ## cavs_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 475 |
+static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\
|
|
| 479 | 476 |
OPNAME ## cavs_filt ## SIZE ## _hv_qq(dst, src, src+stride+1,stride, stride); \ |
| 480 | 477 |
}\ |
| 481 | 478 |
|
| ... | ... |
@@ -509,3 +505,37 @@ CAVS_MC(put_, 8) |
| 509 | 509 |
CAVS_MC(put_, 16) |
| 510 | 510 |
CAVS_MC(avg_, 8) |
| 511 | 511 |
CAVS_MC(avg_, 16) |
| 512 |
+ |
|
| 513 |
+void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 514 |
+void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 515 |
+void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 516 |
+void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 517 |
+ |
|
| 518 |
+void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx) {
|
|
| 519 |
+#define dspfunc(PFX, IDX, NUM) \ |
|
| 520 |
+ c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_c; \ |
|
| 521 |
+ c->PFX ## _pixels_tab[IDX][ 1] = ff_ ## PFX ## NUM ## _mc10_c; \ |
|
| 522 |
+ c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_c; \ |
|
| 523 |
+ c->PFX ## _pixels_tab[IDX][ 3] = ff_ ## PFX ## NUM ## _mc30_c; \ |
|
| 524 |
+ c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_c; \ |
|
| 525 |
+ c->PFX ## _pixels_tab[IDX][ 5] = ff_ ## PFX ## NUM ## _mc11_c; \ |
|
| 526 |
+ c->PFX ## _pixels_tab[IDX][ 6] = ff_ ## PFX ## NUM ## _mc21_c; \ |
|
| 527 |
+ c->PFX ## _pixels_tab[IDX][ 7] = ff_ ## PFX ## NUM ## _mc31_c; \ |
|
| 528 |
+ c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_c; \ |
|
| 529 |
+ c->PFX ## _pixels_tab[IDX][ 9] = ff_ ## PFX ## NUM ## _mc12_c; \ |
|
| 530 |
+ c->PFX ## _pixels_tab[IDX][10] = ff_ ## PFX ## NUM ## _mc22_c; \ |
|
| 531 |
+ c->PFX ## _pixels_tab[IDX][11] = ff_ ## PFX ## NUM ## _mc32_c; \ |
|
| 532 |
+ c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_c; \ |
|
| 533 |
+ c->PFX ## _pixels_tab[IDX][13] = ff_ ## PFX ## NUM ## _mc13_c; \ |
|
| 534 |
+ c->PFX ## _pixels_tab[IDX][14] = ff_ ## PFX ## NUM ## _mc23_c; \ |
|
| 535 |
+ c->PFX ## _pixels_tab[IDX][15] = ff_ ## PFX ## NUM ## _mc33_c |
|
| 536 |
+ dspfunc(put_cavs_qpel, 0, 16); |
|
| 537 |
+ dspfunc(put_cavs_qpel, 1, 8); |
|
| 538 |
+ dspfunc(avg_cavs_qpel, 0, 16); |
|
| 539 |
+ dspfunc(avg_cavs_qpel, 1, 8); |
|
| 540 |
+ c->cavs_filter_lv = cavs_filter_lv_c; |
|
| 541 |
+ c->cavs_filter_lh = cavs_filter_lh_c; |
|
| 542 |
+ c->cavs_filter_cv = cavs_filter_cv_c; |
|
| 543 |
+ c->cavs_filter_ch = cavs_filter_ch_c; |
|
| 544 |
+ c->cavs_idct8_add = cavs_idct8_add_c; |
|
| 545 |
+} |
| 512 | 546 |
deleted file mode 100644 |
| ... | ... |
@@ -1,95 +0,0 @@ |
| 1 |
-/* |
|
| 2 |
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. |
|
| 3 |
- * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> |
|
| 4 |
- * |
|
| 5 |
- * DSP function prototypes |
|
| 6 |
- * |
|
| 7 |
- * This library is free software; you can redistribute it and/or |
|
| 8 |
- * modify it under the terms of the GNU Lesser General Public |
|
| 9 |
- * License as published by the Free Software Foundation; either |
|
| 10 |
- * version 2 of the License, or (at your option) any later version. |
|
| 11 |
- * |
|
| 12 |
- * This library is distributed in the hope that it will be useful, |
|
| 13 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 14 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 15 |
- * Lesser General Public License for more details. |
|
| 16 |
- * |
|
| 17 |
- * You should have received a copy of the GNU Lesser General Public |
|
| 18 |
- * License along with this library; if not, write to the Free Software |
|
| 19 |
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
| 20 |
- */ |
|
| 21 |
- |
|
| 22 |
-void put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 23 |
-void put_cavs_qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 24 |
-void put_cavs_qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 25 |
-void put_cavs_qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 26 |
-void put_cavs_qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 27 |
-void put_cavs_qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 28 |
-void put_cavs_qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 29 |
-void put_cavs_qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 30 |
-void put_cavs_qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 31 |
-void put_cavs_qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 32 |
-void put_cavs_qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 33 |
-void put_cavs_qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 34 |
-void put_cavs_qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 35 |
-void put_cavs_qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 36 |
-void put_cavs_qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 37 |
-void put_cavs_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 38 |
-void put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 39 |
-void put_cavs_qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 40 |
-void put_cavs_qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 41 |
-void put_cavs_qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 42 |
-void put_cavs_qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 43 |
-void put_cavs_qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 44 |
-void put_cavs_qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 45 |
-void put_cavs_qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 46 |
-void put_cavs_qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 47 |
-void put_cavs_qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 48 |
-void put_cavs_qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 49 |
-void put_cavs_qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 50 |
-void put_cavs_qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 51 |
-void put_cavs_qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 52 |
-void put_cavs_qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 53 |
-void put_cavs_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 54 |
-void avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 55 |
-void avg_cavs_qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 56 |
-void avg_cavs_qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 57 |
-void avg_cavs_qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 58 |
-void avg_cavs_qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 59 |
-void avg_cavs_qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 60 |
-void avg_cavs_qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 61 |
-void avg_cavs_qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 62 |
-void avg_cavs_qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 63 |
-void avg_cavs_qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 64 |
-void avg_cavs_qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 65 |
-void avg_cavs_qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 66 |
-void avg_cavs_qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 67 |
-void avg_cavs_qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 68 |
-void avg_cavs_qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 69 |
-void avg_cavs_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 70 |
-void avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 71 |
-void avg_cavs_qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 72 |
-void avg_cavs_qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 73 |
-void avg_cavs_qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 74 |
-void avg_cavs_qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 75 |
-void avg_cavs_qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 76 |
-void avg_cavs_qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 77 |
-void avg_cavs_qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 78 |
-void avg_cavs_qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 79 |
-void avg_cavs_qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 80 |
-void avg_cavs_qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 81 |
-void avg_cavs_qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 82 |
-void avg_cavs_qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 83 |
-void avg_cavs_qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 84 |
-void avg_cavs_qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 85 |
-void avg_cavs_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride); |
|
| 86 |
-void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2); |
|
| 87 |
-void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2); |
|
| 88 |
-void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2); |
|
| 89 |
-void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc, int bs1, int bs2); |
|
| 90 |
-void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride); |
|
| 91 |
- |
|
| 92 |
-void put_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h); |
|
| 93 |
-void put_pixels16_c(uint8_t *block, const uint8_t *pixels, int line_size, int h); |
|
| 94 |
-void avg_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h); |
|
| 95 |
-void avg_pixels16_c(uint8_t *block, const uint8_t *pixels, int line_size, int h); |
| ... | ... |
@@ -2570,6 +2570,22 @@ static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int |
| 2570 | 2570 |
} |
| 2571 | 2571 |
} |
| 2572 | 2572 |
|
| 2573 |
+/* AVS specific */ |
|
| 2574 |
+void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx); |
|
| 2575 |
+ |
|
| 2576 |
+void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
|
|
| 2577 |
+ put_pixels8_c(dst, src, stride, 8); |
|
| 2578 |
+} |
|
| 2579 |
+void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
|
|
| 2580 |
+ avg_pixels8_c(dst, src, stride, 8); |
|
| 2581 |
+} |
|
| 2582 |
+void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
|
|
| 2583 |
+ put_pixels16_c(dst, src, stride, 16); |
|
| 2584 |
+} |
|
| 2585 |
+void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
|
|
| 2586 |
+ avg_pixels16_c(dst, src, stride, 16); |
|
| 2587 |
+} |
|
| 2588 |
+ |
|
| 2573 | 2589 |
static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){
|
| 2574 | 2590 |
uint8_t *cm = cropTbl + MAX_NEG_CROP; |
| 2575 | 2591 |
int i; |
| ... | ... |
@@ -3989,6 +4005,8 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx) |
| 3989 | 3989 |
c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c; |
| 3990 | 3990 |
c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c; |
| 3991 | 3991 |
|
| 3992 |
+ ff_cavsdsp_init(c,avctx); |
|
| 3993 |
+ |
|
| 3992 | 3994 |
c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c; |
| 3993 | 3995 |
c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; |
| 3994 | 3996 |
c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c; |
| ... | ... |
@@ -274,6 +274,15 @@ typedef struct DSPContext {
|
| 274 | 274 |
h264_weight_func weight_h264_pixels_tab[10]; |
| 275 | 275 |
h264_biweight_func biweight_h264_pixels_tab[10]; |
| 276 | 276 |
|
| 277 |
+ /* AVS specific */ |
|
| 278 |
+ qpel_mc_func put_cavs_qpel_pixels_tab[2][16]; |
|
| 279 |
+ qpel_mc_func avg_cavs_qpel_pixels_tab[2][16]; |
|
| 280 |
+ void (*cavs_filter_lv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); |
|
| 281 |
+ void (*cavs_filter_lh)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); |
|
| 282 |
+ void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); |
|
| 283 |
+ void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2); |
|
| 284 |
+ void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride); |
|
| 285 |
+ |
|
| 277 | 286 |
me_cmp_func pix_abs[2][4]; |
| 278 | 287 |
|
| 279 | 288 |
/* huffyuv specific */ |
| ... | ... |
@@ -533,6 +533,30 @@ static int mpeg4video_parse(AVCodecParserContext *s, |
| 533 | 533 |
return next; |
| 534 | 534 |
} |
| 535 | 535 |
|
| 536 |
+static int cavsvideo_parse(AVCodecParserContext *s, |
|
| 537 |
+ AVCodecContext *avctx, |
|
| 538 |
+ uint8_t **poutbuf, int *poutbuf_size, |
|
| 539 |
+ const uint8_t *buf, int buf_size) |
|
| 540 |
+{
|
|
| 541 |
+ ParseContext *pc = s->priv_data; |
|
| 542 |
+ int next; |
|
| 543 |
+ |
|
| 544 |
+ if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
|
|
| 545 |
+ next= buf_size; |
|
| 546 |
+ }else{
|
|
| 547 |
+ next= ff_cavs_find_frame_end(pc, buf, buf_size); |
|
| 548 |
+ |
|
| 549 |
+ if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
|
|
| 550 |
+ *poutbuf = NULL; |
|
| 551 |
+ *poutbuf_size = 0; |
|
| 552 |
+ return buf_size; |
|
| 553 |
+ } |
|
| 554 |
+ } |
|
| 555 |
+ *poutbuf = (uint8_t *)buf; |
|
| 556 |
+ *poutbuf_size = buf_size; |
|
| 557 |
+ return next; |
|
| 558 |
+} |
|
| 559 |
+ |
|
| 536 | 560 |
static int mpeg4video_split(AVCodecContext *avctx, |
| 537 | 561 |
const uint8_t *buf, int buf_size) |
| 538 | 562 |
{
|
| ... | ... |
@@ -987,6 +1011,15 @@ AVCodecParser mpeg4video_parser = {
|
| 987 | 987 |
mpeg4video_split, |
| 988 | 988 |
}; |
| 989 | 989 |
|
| 990 |
+AVCodecParser cavsvideo_parser = {
|
|
| 991 |
+ { CODEC_ID_CAVS },
|
|
| 992 |
+ sizeof(ParseContext1), |
|
| 993 |
+ NULL, |
|
| 994 |
+ cavsvideo_parse, |
|
| 995 |
+ parse1_close, |
|
| 996 |
+ mpeg4video_split, |
|
| 997 |
+}; |
|
| 998 |
+ |
|
| 990 | 999 |
AVCodecParser mpegaudio_parser = {
|
| 991 | 1000 |
{ CODEC_ID_MP2, CODEC_ID_MP3 },
|
| 992 | 1001 |
sizeof(MpegAudioParseContext), |