OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 | 11 |
12 #ifndef VP8_ENCODER_RDOPT_H_ | 12 #ifndef VP8_ENCODER_RDOPT_H_ |
13 #define VP8_ENCODER_RDOPT_H_ | 13 #define VP8_ENCODER_RDOPT_H_ |
14 | 14 |
| 15 #include "./vpx_config.h" |
| 16 |
15 #ifdef __cplusplus | 17 #ifdef __cplusplus |
16 extern "C" { | 18 extern "C" { |
17 #endif | 19 #endif |
18 | 20 |
19 #define RDCOST(RM,DM,R,D) ( ((128+(R)*(RM)) >> 8) + (DM)*(D) ) | 21 #define RDCOST(RM,DM,R,D) ( ((128+(R)*(RM)) >> 8) + (DM)*(D) ) |
20 | 22 |
21 static void insertsortmv(int arr[], int len) | 23 static INLINE void insertsortmv(int arr[], int len) |
22 { | 24 { |
23 int i, j, k; | 25 int i, j, k; |
24 | 26 |
25 for ( i = 1 ; i <= len-1 ; i++ ) | 27 for ( i = 1 ; i <= len-1 ; i++ ) |
26 { | 28 { |
27 for ( j = 0 ; j < i ; j++ ) | 29 for ( j = 0 ; j < i ; j++ ) |
28 { | 30 { |
29 if ( arr[j] > arr[i] ) | 31 if ( arr[j] > arr[i] ) |
30 { | 32 { |
31 int temp; | 33 int temp; |
32 | 34 |
33 temp = arr[i]; | 35 temp = arr[i]; |
34 | 36 |
35 for ( k = i; k >j; k--) | 37 for ( k = i; k >j; k--) |
36 arr[k] = arr[k - 1] ; | 38 arr[k] = arr[k - 1] ; |
37 | 39 |
38 arr[j] = temp ; | 40 arr[j] = temp ; |
39 } | 41 } |
40 } | 42 } |
41 } | 43 } |
42 } | 44 } |
43 | 45 |
44 static void insertsortsad(int arr[],int idx[], int len) | 46 static INLINE void insertsortsad(int arr[],int idx[], int len) |
45 { | 47 { |
46 int i, j, k; | 48 int i, j, k; |
47 | 49 |
48 for ( i = 1 ; i <= len-1 ; i++ ) | 50 for ( i = 1 ; i <= len-1 ; i++ ) |
49 { | 51 { |
50 for ( j = 0 ; j < i ; j++ ) | 52 for ( j = 0 ; j < i ; j++ ) |
51 { | 53 { |
52 if ( arr[j] > arr[i] ) | 54 if ( arr[j] > arr[i] ) |
53 { | 55 { |
54 int temp, tempi; | 56 int temp, tempi; |
(...skipping 15 matching lines...) Expand all Loading... |
70 } | 72 } |
71 | 73 |
72 extern void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue); | 74 extern void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue); |
73 extern void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, | 75 extern void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, |
74 int recon_yoffset, int recon_uvoffset, | 76 int recon_yoffset, int recon_uvoffset, |
75 int *returnrate, int *returndistortion, | 77 int *returnrate, int *returndistortion, |
76 int *returnintra, int mb_row, int mb_col); | 78 int *returnintra, int mb_row, int mb_col); |
77 extern void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate); | 79 extern void vp8_rd_pick_intra_mode(MACROBLOCK *x, int *rate); |
78 | 80 |
79 | 81 |
80 static void get_plane_pointers(const YV12_BUFFER_CONFIG *fb, | 82 static INLINE void get_plane_pointers(const YV12_BUFFER_CONFIG *fb, |
81 unsigned char *plane[3], | 83 unsigned char *plane[3], |
82 unsigned int recon_yoffset, | 84 unsigned int recon_yoffset, |
83 unsigned int recon_uvoffset) | 85 unsigned int recon_uvoffset) |
84 { | 86 { |
85 plane[0] = fb->y_buffer + recon_yoffset; | 87 plane[0] = fb->y_buffer + recon_yoffset; |
86 plane[1] = fb->u_buffer + recon_uvoffset; | 88 plane[1] = fb->u_buffer + recon_uvoffset; |
87 plane[2] = fb->v_buffer + recon_uvoffset; | 89 plane[2] = fb->v_buffer + recon_uvoffset; |
88 } | 90 } |
89 | 91 |
90 | 92 |
91 static void get_predictor_pointers(const VP8_COMP *cpi, | 93 static INLINE void get_predictor_pointers(const VP8_COMP *cpi, |
92 unsigned char *plane[4][3], | 94 unsigned char *plane[4][3], |
93 unsigned int recon_yoffset, | 95 unsigned int recon_yoffset, |
94 unsigned int recon_uvoffset) | 96 unsigned int recon_uvoffset) |
95 { | 97 { |
96 if (cpi->ref_frame_flags & VP8_LAST_FRAME) | 98 if (cpi->ref_frame_flags & VP8_LAST_FRAME) |
97 get_plane_pointers(&cpi->common.yv12_fb[cpi->common.lst_fb_idx], | 99 get_plane_pointers(&cpi->common.yv12_fb[cpi->common.lst_fb_idx], |
98 plane[LAST_FRAME], recon_yoffset, recon_uvoffset); | 100 plane[LAST_FRAME], recon_yoffset, recon_uvoffset); |
99 | 101 |
100 if (cpi->ref_frame_flags & VP8_GOLD_FRAME) | 102 if (cpi->ref_frame_flags & VP8_GOLD_FRAME) |
101 get_plane_pointers(&cpi->common.yv12_fb[cpi->common.gld_fb_idx], | 103 get_plane_pointers(&cpi->common.yv12_fb[cpi->common.gld_fb_idx], |
102 plane[GOLDEN_FRAME], recon_yoffset, recon_uvoffset); | 104 plane[GOLDEN_FRAME], recon_yoffset, recon_uvoffset); |
103 | 105 |
104 if (cpi->ref_frame_flags & VP8_ALTR_FRAME) | 106 if (cpi->ref_frame_flags & VP8_ALTR_FRAME) |
105 get_plane_pointers(&cpi->common.yv12_fb[cpi->common.alt_fb_idx], | 107 get_plane_pointers(&cpi->common.yv12_fb[cpi->common.alt_fb_idx], |
106 plane[ALTREF_FRAME], recon_yoffset, recon_uvoffset); | 108 plane[ALTREF_FRAME], recon_yoffset, recon_uvoffset); |
107 } | 109 } |
108 | 110 |
109 | 111 |
110 static void get_reference_search_order(const VP8_COMP *cpi, | 112 static INLINE void get_reference_search_order(const VP8_COMP *cpi, |
111 int ref_frame_map[4]) | 113 int ref_frame_map[4]) |
112 { | 114 { |
113 int i=0; | 115 int i=0; |
114 | 116 |
115 ref_frame_map[i++] = INTRA_FRAME; | 117 ref_frame_map[i++] = INTRA_FRAME; |
116 if (cpi->ref_frame_flags & VP8_LAST_FRAME) | 118 if (cpi->ref_frame_flags & VP8_LAST_FRAME) |
117 ref_frame_map[i++] = LAST_FRAME; | 119 ref_frame_map[i++] = LAST_FRAME; |
118 if (cpi->ref_frame_flags & VP8_GOLD_FRAME) | 120 if (cpi->ref_frame_flags & VP8_GOLD_FRAME) |
119 ref_frame_map[i++] = GOLDEN_FRAME; | 121 ref_frame_map[i++] = GOLDEN_FRAME; |
120 if (cpi->ref_frame_flags & VP8_ALTR_FRAME) | 122 if (cpi->ref_frame_flags & VP8_ALTR_FRAME) |
121 ref_frame_map[i++] = ALTREF_FRAME; | 123 ref_frame_map[i++] = ALTREF_FRAME; |
(...skipping 16 matching lines...) Expand all Loading... |
138 void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffse
t, int near_sadidx[]); | 140 void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffse
t, int near_sadidx[]); |
139 int VP8_UVSSE(MACROBLOCK *x); | 141 int VP8_UVSSE(MACROBLOCK *x); |
140 int vp8_cost_mv_ref(MB_PREDICTION_MODE m, const int near_mv_ref_ct[4]); | 142 int vp8_cost_mv_ref(MB_PREDICTION_MODE m, const int near_mv_ref_ct[4]); |
141 void vp8_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv); | 143 void vp8_set_mbmode_and_mvs(MACROBLOCK *x, MB_PREDICTION_MODE mb, int_mv *mv); |
142 | 144 |
143 #ifdef __cplusplus | 145 #ifdef __cplusplus |
144 } // extern "C" | 146 } // extern "C" |
145 #endif | 147 #endif |
146 | 148 |
147 #endif // VP8_ENCODER_RDOPT_H_ | 149 #endif // VP8_ENCODER_RDOPT_H_ |
OLD | NEW |