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 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 dst->buf += 8 * dst->stride; | 1185 dst->buf += 8 * dst->stride; |
1186 mask_16x16 >>= 4; | 1186 mask_16x16 >>= 4; |
1187 mask_8x8 >>= 4; | 1187 mask_8x8 >>= 4; |
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, |
| 1196 struct macroblockd_plane planes[MAX_MB_PLANE], |
1196 int start, int stop, int y_only) { | 1197 int start, int stop, int y_only) { |
1197 const int num_planes = y_only ? 1 : MAX_MB_PLANE; | 1198 const int num_planes = y_only ? 1 : MAX_MB_PLANE; |
1198 const int use_420 = y_only || (xd->plane[1].subsampling_y == 1 && | 1199 const int use_420 = y_only || (planes[1].subsampling_y == 1 && |
1199 xd->plane[1].subsampling_x == 1); | 1200 planes[1].subsampling_x == 1); |
1200 LOOP_FILTER_MASK lfm; | 1201 LOOP_FILTER_MASK lfm; |
1201 int mi_row, mi_col; | 1202 int mi_row, mi_col; |
1202 | 1203 |
1203 for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) { | 1204 for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) { |
1204 MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; | 1205 MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; |
1205 | 1206 |
1206 for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) { | 1207 for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) { |
1207 int plane; | 1208 int plane; |
1208 | 1209 |
1209 vp9_setup_dst_planes(xd, frame_buffer, mi_row, mi_col); | 1210 vp9_setup_dst_planes(planes, frame_buffer, mi_row, mi_col); |
1210 | 1211 |
1211 // TODO(JBB): Make setup_mask work for non 420. | 1212 // TODO(JBB): Make setup_mask work for non 420. |
1212 if (use_420) | 1213 if (use_420) |
1213 vp9_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride, | 1214 vp9_setup_mask(cm, mi_row, mi_col, mi + mi_col, cm->mi_stride, |
1214 &lfm); | 1215 &lfm); |
1215 | 1216 |
1216 for (plane = 0; plane < num_planes; ++plane) { | 1217 for (plane = 0; plane < num_planes; ++plane) { |
1217 if (use_420) | 1218 if (use_420) |
1218 vp9_filter_block_plane(cm, &xd->plane[plane], mi_row, &lfm); | 1219 vp9_filter_block_plane(cm, &planes[plane], mi_row, &lfm); |
1219 else | 1220 else |
1220 filter_block_plane_non420(cm, &xd->plane[plane], mi + mi_col, | 1221 filter_block_plane_non420(cm, &planes[plane], mi + mi_col, |
1221 mi_row, mi_col); | 1222 mi_row, mi_col); |
1222 } | 1223 } |
1223 } | 1224 } |
1224 } | 1225 } |
1225 } | 1226 } |
1226 | 1227 |
1227 void vp9_loop_filter_frame(YV12_BUFFER_CONFIG *frame, | 1228 void vp9_loop_filter_frame(YV12_BUFFER_CONFIG *frame, |
1228 VP9_COMMON *cm, MACROBLOCKD *xd, | 1229 VP9_COMMON *cm, MACROBLOCKD *xd, |
1229 int frame_filter_level, | 1230 int frame_filter_level, |
1230 int y_only, int partial_frame) { | 1231 int y_only, int partial_frame) { |
1231 int start_mi_row, end_mi_row, mi_rows_to_filter; | 1232 int start_mi_row, end_mi_row, mi_rows_to_filter; |
1232 if (!frame_filter_level) return; | 1233 if (!frame_filter_level) return; |
1233 start_mi_row = 0; | 1234 start_mi_row = 0; |
1234 mi_rows_to_filter = cm->mi_rows; | 1235 mi_rows_to_filter = cm->mi_rows; |
1235 if (partial_frame && cm->mi_rows > 8) { | 1236 if (partial_frame && cm->mi_rows > 8) { |
1236 start_mi_row = cm->mi_rows >> 1; | 1237 start_mi_row = cm->mi_rows >> 1; |
1237 start_mi_row &= 0xfffffff8; | 1238 start_mi_row &= 0xfffffff8; |
1238 mi_rows_to_filter = MAX(cm->mi_rows / 8, 8); | 1239 mi_rows_to_filter = MAX(cm->mi_rows / 8, 8); |
1239 } | 1240 } |
1240 end_mi_row = start_mi_row + mi_rows_to_filter; | 1241 end_mi_row = start_mi_row + mi_rows_to_filter; |
1241 vp9_loop_filter_frame_init(cm, frame_filter_level); | 1242 vp9_loop_filter_frame_init(cm, frame_filter_level); |
1242 vp9_loop_filter_rows(frame, cm, xd, | 1243 vp9_loop_filter_rows(frame, cm, xd->plane, |
1243 start_mi_row, end_mi_row, | 1244 start_mi_row, end_mi_row, |
1244 y_only); | 1245 y_only); |
1245 } | 1246 } |
1246 | 1247 |
1247 int vp9_loop_filter_worker(void *arg1, void *arg2) { | 1248 int vp9_loop_filter_worker(void *arg1, void *arg2) { |
1248 LFWorkerData *const lf_data = (LFWorkerData*)arg1; | 1249 LFWorkerData *const lf_data = (LFWorkerData*)arg1; |
1249 (void)arg2; | 1250 (void)arg2; |
1250 vp9_loop_filter_rows(lf_data->frame_buffer, lf_data->cm, &lf_data->xd, | 1251 vp9_loop_filter_rows(lf_data->frame_buffer, lf_data->cm, lf_data->planes, |
1251 lf_data->start, lf_data->stop, lf_data->y_only); | 1252 lf_data->start, lf_data->stop, lf_data->y_only); |
1252 return 1; | 1253 return 1; |
1253 } | 1254 } |
OLD | NEW |