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 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 left_64x64_txform_mask[tx_size_y]) << shift_y; | 612 left_64x64_txform_mask[tx_size_y]) << shift_y; |
613 | 613 |
614 if (tx_size_y == TX_4X4) | 614 if (tx_size_y == TX_4X4) |
615 *int_4x4_y |= (size_mask[block_size] & 0xffffffffffffffff) << shift_y; | 615 *int_4x4_y |= (size_mask[block_size] & 0xffffffffffffffff) << shift_y; |
616 } | 616 } |
617 | 617 |
618 // This function sets up the bit masks for the entire 64x64 region represented | 618 // This function sets up the bit masks for the entire 64x64 region represented |
619 // by mi_row, mi_col. | 619 // by mi_row, mi_col. |
620 // TODO(JBB): This function only works for yv12. | 620 // TODO(JBB): This function only works for yv12. |
621 void vp9_setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col, | 621 void vp9_setup_mask(VP9_COMMON *const cm, const int mi_row, const int mi_col, |
622 MODE_INFO **mi_8x8, const int mode_info_stride, | 622 MODE_INFO **mi, const int mode_info_stride, |
623 LOOP_FILTER_MASK *lfm) { | 623 LOOP_FILTER_MASK *lfm) { |
624 int idx_32, idx_16, idx_8; | 624 int idx_32, idx_16, idx_8; |
625 const loop_filter_info_n *const lfi_n = &cm->lf_info; | 625 const loop_filter_info_n *const lfi_n = &cm->lf_info; |
626 MODE_INFO **mip = mi_8x8; | 626 MODE_INFO **mip = mi; |
627 MODE_INFO **mip2 = mi_8x8; | 627 MODE_INFO **mip2 = mi; |
628 | 628 |
629 // These are offsets to the next mi in the 64x64 block. It is what gets | 629 // These are offsets to the next mi in the 64x64 block. It is what gets |
630 // added to the mi ptr as we go through each loop. It helps us to avoids | 630 // added to the mi ptr as we go through each loop. It helps us to avoids |
631 // setting up special row and column counters for each index. The last step | 631 // setting up special row and column counters for each index. The last step |
632 // brings us out back to the starting position. | 632 // brings us out back to the starting position. |
633 const int offset_32[] = {4, (mode_info_stride << 2) - 4, 4, | 633 const int offset_32[] = {4, (mode_info_stride << 2) - 4, 4, |
634 -(mode_info_stride << 2) - 4}; | 634 -(mode_info_stride << 2) - 4}; |
635 const int offset_16[] = {2, (mode_info_stride << 1) - 2, 2, | 635 const int offset_16[] = {2, (mode_info_stride << 1) - 2, 2, |
636 -(mode_info_stride << 1) - 2}; | 636 -(mode_info_stride << 1) - 2}; |
637 const int offset[] = {1, mode_info_stride - 1, 1, -mode_info_stride - 1}; | 637 const int offset[] = {1, mode_info_stride - 1, 1, -mode_info_stride - 1}; |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 mask_4x4 >>= 4; | 1188 mask_4x4 >>= 4; |
1189 mask_4x4_int >>= 4; | 1189 mask_4x4_int >>= 4; |
1190 } | 1190 } |
1191 } | 1191 } |
1192 } | 1192 } |
1193 | 1193 |
1194 void vp9_loop_filter_rows(const YV12_BUFFER_CONFIG *frame_buffer, | 1194 void vp9_loop_filter_rows(const YV12_BUFFER_CONFIG *frame_buffer, |
1195 VP9_COMMON *cm, MACROBLOCKD *xd, | 1195 VP9_COMMON *cm, MACROBLOCKD *xd, |
1196 int start, int stop, int y_only) { | 1196 int start, int stop, int y_only) { |
1197 const int num_planes = y_only ? 1 : MAX_MB_PLANE; | 1197 const int num_planes = y_only ? 1 : MAX_MB_PLANE; |
| 1198 const int use_420 = y_only || (xd->plane[1].subsampling_y == 1 && |
| 1199 xd->plane[1].subsampling_x == 1); |
| 1200 LOOP_FILTER_MASK lfm; |
1198 int mi_row, mi_col; | 1201 int mi_row, mi_col; |
1199 LOOP_FILTER_MASK lfm; | |
1200 int use_420 = y_only || (xd->plane[1].subsampling_y == 1 && | |
1201 xd->plane[1].subsampling_x == 1); | |
1202 | 1202 |
1203 for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) { | 1203 for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) { |
1204 MODE_INFO **mi_8x8 = cm->mi_grid_visible + mi_row * cm->mi_stride; | 1204 MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; |
1205 | 1205 |
1206 for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) { | 1206 for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) { |
1207 int plane; | 1207 int plane; |
1208 | 1208 |
1209 vp9_setup_dst_planes(xd, frame_buffer, mi_row, mi_col); | 1209 vp9_setup_dst_planes(xd, frame_buffer, mi_row, mi_col); |
1210 | 1210 |
1211 // TODO(JBB): Make setup_mask work for non 420. | 1211 // TODO(JBB): Make setup_mask work for non 420. |
1212 if (use_420) | 1212 if (use_420) |
1213 vp9_setup_mask(cm, mi_row, mi_col, mi_8x8 + mi_col, cm->mi_stride, | 1213 vp9_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride, |
1214 &lfm); | 1214 &lfm); |
1215 | 1215 |
1216 for (plane = 0; plane < num_planes; ++plane) { | 1216 for (plane = 0; plane < num_planes; ++plane) { |
1217 if (use_420) | 1217 if (use_420) |
1218 vp9_filter_block_plane(cm, &xd->plane[plane], mi_row, &lfm); | 1218 vp9_filter_block_plane(cm, &xd->plane[plane], mi_row, &lfm); |
1219 else | 1219 else |
1220 filter_block_plane_non420(cm, &xd->plane[plane], mi_8x8 + mi_col, | 1220 filter_block_plane_non420(cm, &xd->plane[plane], mi + mi_col, |
1221 mi_row, mi_col); | 1221 mi_row, mi_col); |
1222 } | 1222 } |
1223 } | 1223 } |
1224 } | 1224 } |
1225 } | 1225 } |
1226 | 1226 |
1227 void vp9_loop_filter_frame(VP9_COMMON *cm, MACROBLOCKD *xd, | 1227 void vp9_loop_filter_frame(YV12_BUFFER_CONFIG *frame, |
| 1228 VP9_COMMON *cm, MACROBLOCKD *xd, |
1228 int frame_filter_level, | 1229 int frame_filter_level, |
1229 int y_only, int partial_frame) { | 1230 int y_only, int partial_frame) { |
1230 int start_mi_row, end_mi_row, mi_rows_to_filter; | 1231 int start_mi_row, end_mi_row, mi_rows_to_filter; |
1231 if (!frame_filter_level) return; | 1232 if (!frame_filter_level) return; |
1232 start_mi_row = 0; | 1233 start_mi_row = 0; |
1233 mi_rows_to_filter = cm->mi_rows; | 1234 mi_rows_to_filter = cm->mi_rows; |
1234 if (partial_frame && cm->mi_rows > 8) { | 1235 if (partial_frame && cm->mi_rows > 8) { |
1235 start_mi_row = cm->mi_rows >> 1; | 1236 start_mi_row = cm->mi_rows >> 1; |
1236 start_mi_row &= 0xfffffff8; | 1237 start_mi_row &= 0xfffffff8; |
1237 mi_rows_to_filter = MAX(cm->mi_rows / 8, 8); | 1238 mi_rows_to_filter = MAX(cm->mi_rows / 8, 8); |
1238 } | 1239 } |
1239 end_mi_row = start_mi_row + mi_rows_to_filter; | 1240 end_mi_row = start_mi_row + mi_rows_to_filter; |
1240 vp9_loop_filter_frame_init(cm, frame_filter_level); | 1241 vp9_loop_filter_frame_init(cm, frame_filter_level); |
1241 vp9_loop_filter_rows(cm->frame_to_show, cm, xd, | 1242 vp9_loop_filter_rows(frame, cm, xd, |
1242 start_mi_row, end_mi_row, | 1243 start_mi_row, end_mi_row, |
1243 y_only); | 1244 y_only); |
1244 } | 1245 } |
1245 | 1246 |
1246 int vp9_loop_filter_worker(void *arg1, void *arg2) { | 1247 int vp9_loop_filter_worker(void *arg1, void *arg2) { |
1247 LFWorkerData *const lf_data = (LFWorkerData*)arg1; | 1248 LFWorkerData *const lf_data = (LFWorkerData*)arg1; |
1248 (void)arg2; | 1249 (void)arg2; |
1249 vp9_loop_filter_rows(lf_data->frame_buffer, lf_data->cm, &lf_data->xd, | 1250 vp9_loop_filter_rows(lf_data->frame_buffer, lf_data->cm, &lf_data->xd, |
1250 lf_data->start, lf_data->stop, lf_data->y_only); | 1251 lf_data->start, lf_data->stop, lf_data->y_only); |
1251 return 1; | 1252 return 1; |
1252 } | 1253 } |
OLD | NEW |