OLD | NEW |
1 /* | 1 /* |
2 * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. | 2 * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. |
3 * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> | 3 * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 * boundary strength (bs) mapping: | 66 * boundary strength (bs) mapping: |
67 * | 67 * |
68 * --4---5-- | 68 * --4---5-- |
69 * 0 2 | | 69 * 0 2 | |
70 * | 6 | 7 | | 70 * | 6 | 7 | |
71 * 1 3 | | 71 * 1 3 | |
72 * --------- | 72 * --------- |
73 * | 73 * |
74 */ | 74 */ |
75 void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) { | 75 void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) { |
76 DECLARE_ALIGNED_8(uint8_t, bs)[8]; | 76 uint8_t bs[8]; |
77 int qp_avg, alpha, beta, tc; | 77 int qp_avg, alpha, beta, tc; |
78 int i; | 78 int i; |
79 | 79 |
80 /* save un-deblocked lines */ | 80 /* save un-deblocked lines */ |
81 h->topleft_border_y = h->top_border_y[h->mbx*16+15]; | 81 h->topleft_border_y = h->top_border_y[h->mbx*16+15]; |
82 h->topleft_border_u = h->top_border_u[h->mbx*10+8]; | 82 h->topleft_border_u = h->top_border_u[h->mbx*10+8]; |
83 h->topleft_border_v = h->top_border_v[h->mbx*10+8]; | 83 h->topleft_border_v = h->top_border_v[h->mbx*10+8]; |
84 memcpy(&h->top_border_y[h->mbx*16], h->cy + 15* h->l_stride,16); | 84 memcpy(&h->top_border_y[h->mbx*16], h->cy + 15* h->l_stride,16); |
85 memcpy(&h->top_border_u[h->mbx*10+1], h->cu + 7* h->c_stride,8); | 85 memcpy(&h->top_border_u[h->mbx*10+1], h->cu + 7* h->c_stride,8); |
86 memcpy(&h->top_border_v[h->mbx*10+1], h->cv + 7* h->c_stride,8); | 86 memcpy(&h->top_border_v[h->mbx*10+1], h->cv + 7* h->c_stride,8); |
87 for(i=0;i<8;i++) { | 87 for(i=0;i<8;i++) { |
88 h->left_border_y[i*2+1] = *(h->cy + 15 + (i*2+0)*h->l_stride); | 88 h->left_border_y[i*2+1] = *(h->cy + 15 + (i*2+0)*h->l_stride); |
89 h->left_border_y[i*2+2] = *(h->cy + 15 + (i*2+1)*h->l_stride); | 89 h->left_border_y[i*2+2] = *(h->cy + 15 + (i*2+1)*h->l_stride); |
90 h->left_border_u[i+1] = *(h->cu + 7 + i*h->c_stride); | 90 h->left_border_u[i+1] = *(h->cu + 7 + i*h->c_stride); |
91 h->left_border_v[i+1] = *(h->cv + 7 + i*h->c_stride); | 91 h->left_border_v[i+1] = *(h->cv + 7 + i*h->c_stride); |
92 } | 92 } |
93 if(!h->loop_filter_disable) { | 93 if(!h->loop_filter_disable) { |
94 /* determine bs */ | 94 /* determine bs */ |
95 if(mb_type == I_8X8) | 95 if(mb_type == I_8X8) |
96 *((uint64_t *)bs) = 0x0202020202020202ULL; | 96 memset(bs,2,8); |
97 else{ | 97 else{ |
98 *((uint64_t *)bs) = 0; | 98 memset(bs,0,8); |
99 if(ff_cavs_partition_flags[mb_type] & SPLITV){ | 99 if(ff_cavs_partition_flags[mb_type] & SPLITV){ |
100 bs[2] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X1], mb_type > P
_8X8); | 100 bs[2] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X1], mb_type > P
_8X8); |
101 bs[3] = get_bs(&h->mv[MV_FWD_X2], &h->mv[MV_FWD_X3], mb_type > P
_8X8); | 101 bs[3] = get_bs(&h->mv[MV_FWD_X2], &h->mv[MV_FWD_X3], mb_type > P
_8X8); |
102 } | 102 } |
103 if(ff_cavs_partition_flags[mb_type] & SPLITH){ | 103 if(ff_cavs_partition_flags[mb_type] & SPLITH){ |
104 bs[6] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X2], mb_type > P
_8X8); | 104 bs[6] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X2], mb_type > P
_8X8); |
105 bs[7] = get_bs(&h->mv[MV_FWD_X1], &h->mv[MV_FWD_X3], mb_type > P
_8X8); | 105 bs[7] = get_bs(&h->mv[MV_FWD_X1], &h->mv[MV_FWD_X3], mb_type > P
_8X8); |
106 } | 106 } |
107 bs[0] = get_bs(&h->mv[MV_FWD_A1], &h->mv[MV_FWD_X0], mb_type > P_8X8
); | 107 bs[0] = get_bs(&h->mv[MV_FWD_A1], &h->mv[MV_FWD_X0], mb_type > P_8X8
); |
108 bs[1] = get_bs(&h->mv[MV_FWD_A3], &h->mv[MV_FWD_X2], mb_type > P_8X8
); | 108 bs[1] = get_bs(&h->mv[MV_FWD_A3], &h->mv[MV_FWD_X2], mb_type > P_8X8
); |
109 bs[4] = get_bs(&h->mv[MV_FWD_B2], &h->mv[MV_FWD_X0], mb_type > P_8X8
); | 109 bs[4] = get_bs(&h->mv[MV_FWD_B2], &h->mv[MV_FWD_X0], mb_type > P_8X8
); |
110 bs[5] = get_bs(&h->mv[MV_FWD_B3], &h->mv[MV_FWD_X1], mb_type > P_8X8
); | 110 bs[5] = get_bs(&h->mv[MV_FWD_B3], &h->mv[MV_FWD_X1], mb_type > P_8X8
); |
111 } | 111 } |
112 if( *((uint64_t *)bs) ) { | 112 if(AV_RN64(bs)) { |
113 if(h->flags & A_AVAIL) { | 113 if(h->flags & A_AVAIL) { |
114 qp_avg = (h->qp + h->left_qp + 1) >> 1; | 114 qp_avg = (h->qp + h->left_qp + 1) >> 1; |
115 SET_PARAMS; | 115 SET_PARAMS; |
116 h->s.dsp.cavs_filter_lv(h->cy,h->l_stride,alpha,beta,tc,bs[0],bs
[1]); | 116 h->s.dsp.cavs_filter_lv(h->cy,h->l_stride,alpha,beta,tc,bs[0],bs
[1]); |
117 h->s.dsp.cavs_filter_cv(h->cu,h->c_stride,alpha,beta,tc,bs[0],bs
[1]); | 117 h->s.dsp.cavs_filter_cv(h->cu,h->c_stride,alpha,beta,tc,bs[0],bs
[1]); |
118 h->s.dsp.cavs_filter_cv(h->cv,h->c_stride,alpha,beta,tc,bs[0],bs
[1]); | 118 h->s.dsp.cavs_filter_cv(h->cv,h->c_stride,alpha,beta,tc,bs[0],bs
[1]); |
119 } | 119 } |
120 qp_avg = h->qp; | 120 qp_avg = h->qp; |
121 SET_PARAMS; | 121 SET_PARAMS; |
122 h->s.dsp.cavs_filter_lv(h->cy + 8,h->l_stride,alpha,beta,tc,bs[2],bs
[3]); | 122 h->s.dsp.cavs_filter_lv(h->cy + 8,h->l_stride,alpha,beta,tc,bs[2],bs
[3]); |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 av_free(h->top_mv[1]); | 706 av_free(h->top_mv[1]); |
707 av_free(h->top_pred_Y); | 707 av_free(h->top_pred_Y); |
708 av_free(h->top_border_y); | 708 av_free(h->top_border_y); |
709 av_free(h->top_border_u); | 709 av_free(h->top_border_u); |
710 av_free(h->top_border_v); | 710 av_free(h->top_border_v); |
711 av_free(h->col_mv); | 711 av_free(h->col_mv); |
712 av_free(h->col_type_base); | 712 av_free(h->col_type_base); |
713 av_free(h->block); | 713 av_free(h->block); |
714 return 0; | 714 return 0; |
715 } | 715 } |
OLD | NEW |