Mercurial > libavcodec.hg
comparison cavs.c @ 8605:33f51dd2491f libavcodec
rename vector_t to cavs_vector
author | stefang |
---|---|
date | Fri, 16 Jan 2009 17:20:17 +0000 |
parents | 48759bfbd073 |
children | c3a96cea3453 |
comparison
equal
deleted
inserted
replaced
8604:48c89068a41b | 8605:33f51dd2491f |
---|---|
35 * | 35 * |
36 * in-loop deblocking filter | 36 * in-loop deblocking filter |
37 * | 37 * |
38 ****************************************************************************/ | 38 ****************************************************************************/ |
39 | 39 |
40 static inline int get_bs(vector_t *mvP, vector_t *mvQ, int b) { | 40 static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b) { |
41 if((mvP->ref == REF_INTRA) || (mvQ->ref == REF_INTRA)) | 41 if((mvP->ref == REF_INTRA) || (mvQ->ref == REF_INTRA)) |
42 return 2; | 42 return 2; |
43 if( (abs(mvP->x - mvQ->x) >= 4) || (abs(mvP->y - mvQ->y) >= 4) ) | 43 if( (abs(mvP->x - mvQ->x) >= 4) || (abs(mvP->y - mvQ->y) >= 4) ) |
44 return 1; | 44 return 1; |
45 if(b){ | 45 if(b){ |
325 | 325 |
326 static inline void mc_dir_part(AVSContext *h,Picture *pic,int square, | 326 static inline void mc_dir_part(AVSContext *h,Picture *pic,int square, |
327 int chroma_height,int delta,int list,uint8_t *dest_y, | 327 int chroma_height,int delta,int list,uint8_t *dest_y, |
328 uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset, | 328 uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset, |
329 int src_y_offset,qpel_mc_func *qpix_op, | 329 int src_y_offset,qpel_mc_func *qpix_op, |
330 h264_chroma_mc_func chroma_op,vector_t *mv){ | 330 h264_chroma_mc_func chroma_op,cavs_vector *mv){ |
331 MpegEncContext * const s = &h->s; | 331 MpegEncContext * const s = &h->s; |
332 const int mx= mv->x + src_x_offset*8; | 332 const int mx= mv->x + src_x_offset*8; |
333 const int my= mv->y + src_y_offset*8; | 333 const int my= mv->y + src_y_offset*8; |
334 const int luma_xy= (mx&3) + ((my&3)<<2); | 334 const int luma_xy= (mx&3) + ((my&3)<<2); |
335 uint8_t * src_y = pic->data[0] + (mx>>2) + (my>>2)*h->l_stride; | 335 uint8_t * src_y = pic->data[0] + (mx>>2) + (my>>2)*h->l_stride; |
380 | 380 |
381 static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int delta, | 381 static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int delta, |
382 uint8_t *dest_y,uint8_t *dest_cb,uint8_t *dest_cr, | 382 uint8_t *dest_y,uint8_t *dest_cb,uint8_t *dest_cr, |
383 int x_offset, int y_offset,qpel_mc_func *qpix_put, | 383 int x_offset, int y_offset,qpel_mc_func *qpix_put, |
384 h264_chroma_mc_func chroma_put,qpel_mc_func *qpix_avg, | 384 h264_chroma_mc_func chroma_put,qpel_mc_func *qpix_avg, |
385 h264_chroma_mc_func chroma_avg, vector_t *mv){ | 385 h264_chroma_mc_func chroma_avg, cavs_vector *mv){ |
386 qpel_mc_func *qpix_op= qpix_put; | 386 qpel_mc_func *qpix_op= qpix_put; |
387 h264_chroma_mc_func chroma_op= chroma_put; | 387 h264_chroma_mc_func chroma_op= chroma_put; |
388 | 388 |
389 dest_y += 2*x_offset + 2*y_offset*h->l_stride; | 389 dest_y += 2*x_offset + 2*y_offset*h->l_stride; |
390 dest_cb += x_offset + y_offset*h->c_stride; | 390 dest_cb += x_offset + y_offset*h->c_stride; |
445 * | 445 * |
446 * motion vector prediction | 446 * motion vector prediction |
447 * | 447 * |
448 ****************************************************************************/ | 448 ****************************************************************************/ |
449 | 449 |
450 static inline void scale_mv(AVSContext *h, int *d_x, int *d_y, vector_t *src, int distp) { | 450 static inline void scale_mv(AVSContext *h, int *d_x, int *d_y, cavs_vector *src, int distp) { |
451 int den = h->scale_den[src->ref]; | 451 int den = h->scale_den[src->ref]; |
452 | 452 |
453 *d_x = (src->x*distp*den + 256 + (src->x>>31)) >> 9; | 453 *d_x = (src->x*distp*den + 256 + (src->x>>31)) >> 9; |
454 *d_y = (src->y*distp*den + 256 + (src->y>>31)) >> 9; | 454 *d_y = (src->y*distp*den + 256 + (src->y>>31)) >> 9; |
455 } | 455 } |
456 | 456 |
457 static inline void mv_pred_median(AVSContext *h, vector_t *mvP, vector_t *mvA, vector_t *mvB, vector_t *mvC) { | 457 static inline void mv_pred_median(AVSContext *h, cavs_vector *mvP, |
458 cavs_vector *mvA, cavs_vector *mvB, cavs_vector *mvC) { | |
458 int ax, ay, bx, by, cx, cy; | 459 int ax, ay, bx, by, cx, cy; |
459 int len_ab, len_bc, len_ca, len_mid; | 460 int len_ab, len_bc, len_ca, len_mid; |
460 | 461 |
461 /* scale candidates according to their temporal span */ | 462 /* scale candidates according to their temporal span */ |
462 scale_mv(h, &ax, &ay, mvA, mvP->dist); | 463 scale_mv(h, &ax, &ay, mvA, mvP->dist); |
479 } | 480 } |
480 } | 481 } |
481 | 482 |
482 void ff_cavs_mv(AVSContext *h, enum mv_loc_t nP, enum mv_loc_t nC, | 483 void ff_cavs_mv(AVSContext *h, enum mv_loc_t nP, enum mv_loc_t nC, |
483 enum mv_pred_t mode, enum block_t size, int ref) { | 484 enum mv_pred_t mode, enum block_t size, int ref) { |
484 vector_t *mvP = &h->mv[nP]; | 485 cavs_vector *mvP = &h->mv[nP]; |
485 vector_t *mvA = &h->mv[nP-1]; | 486 cavs_vector *mvA = &h->mv[nP-1]; |
486 vector_t *mvB = &h->mv[nP-4]; | 487 cavs_vector *mvB = &h->mv[nP-4]; |
487 vector_t *mvC = &h->mv[nC]; | 488 cavs_vector *mvC = &h->mv[nC]; |
488 const vector_t *mvP2 = NULL; | 489 const cavs_vector *mvP2 = NULL; |
489 | 490 |
490 mvP->ref = ref; | 491 mvP->ref = ref; |
491 mvP->dist = h->dist[mvP->ref]; | 492 mvP->dist = h->dist[mvP->ref]; |
492 if(mvC->ref == NOT_AVAIL) | 493 if(mvC->ref == NOT_AVAIL) |
493 mvC = &h->mv[nP-5]; // set to top-left (mvD) | 494 mvC = &h->mv[nP-5]; // set to top-left (mvD) |
653 * and this storage space is allocated here | 654 * and this storage space is allocated here |
654 */ | 655 */ |
655 void ff_cavs_init_top_lines(AVSContext *h) { | 656 void ff_cavs_init_top_lines(AVSContext *h) { |
656 /* alloc top line of predictors */ | 657 /* alloc top line of predictors */ |
657 h->top_qp = av_malloc( h->mb_width); | 658 h->top_qp = av_malloc( h->mb_width); |
658 h->top_mv[0] = av_malloc((h->mb_width*2+1)*sizeof(vector_t)); | 659 h->top_mv[0] = av_malloc((h->mb_width*2+1)*sizeof(cavs_vector)); |
659 h->top_mv[1] = av_malloc((h->mb_width*2+1)*sizeof(vector_t)); | 660 h->top_mv[1] = av_malloc((h->mb_width*2+1)*sizeof(cavs_vector)); |
660 h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y)); | 661 h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y)); |
661 h->top_border_y = av_malloc((h->mb_width+1)*16); | 662 h->top_border_y = av_malloc((h->mb_width+1)*16); |
662 h->top_border_u = av_malloc((h->mb_width)*10); | 663 h->top_border_u = av_malloc((h->mb_width)*10); |
663 h->top_border_v = av_malloc((h->mb_width)*10); | 664 h->top_border_v = av_malloc((h->mb_width)*10); |
664 | 665 |
665 /* alloc space for co-located MVs and types */ | 666 /* alloc space for co-located MVs and types */ |
666 h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(vector_t)); | 667 h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(cavs_vector)); |
667 h->col_type_base = av_malloc(h->mb_width*h->mb_height); | 668 h->col_type_base = av_malloc(h->mb_width*h->mb_height); |
668 h->block = av_mallocz(64*sizeof(DCTELEM)); | 669 h->block = av_mallocz(64*sizeof(DCTELEM)); |
669 } | 670 } |
670 | 671 |
671 av_cold int ff_cavs_init(AVCodecContext *avctx) { | 672 av_cold int ff_cavs_init(AVCodecContext *avctx) { |