| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Initialize elements of cpi with valid defaults. | 46 // Initialize elements of cpi with valid defaults. |
| 47 VP8_COMP cpi; | 47 VP8_COMP cpi; |
| 48 cpi.mb.e_mbd.mb_segement_abs_delta = SEGMENT_DELTADATA; | 48 cpi.mb.e_mbd.mb_segement_abs_delta = SEGMENT_DELTADATA; |
| 49 cpi.cyclic_refresh_mode_enabled = 0; | 49 cpi.cyclic_refresh_mode_enabled = 0; |
| 50 cpi.mb.e_mbd.segmentation_enabled = 0; | 50 cpi.mb.e_mbd.segmentation_enabled = 0; |
| 51 cpi.mb.e_mbd.update_mb_segmentation_map = 0; | 51 cpi.mb.e_mbd.update_mb_segmentation_map = 0; |
| 52 cpi.mb.e_mbd.update_mb_segmentation_data = 0; | 52 cpi.mb.e_mbd.update_mb_segmentation_data = 0; |
| 53 cpi.common.mb_rows = 240 >> 4; | 53 cpi.common.mb_rows = 240 >> 4; |
| 54 cpi.common.mb_cols = 320 >> 4; | 54 cpi.common.mb_cols = 320 >> 4; |
| 55 const int mbs = (cpi.common.mb_rows * cpi.common.mb_cols); | 55 const int mbs = (cpi.common.mb_rows * cpi.common.mb_cols); |
| 56 vpx_memset(cpi.segment_feature_data, 0, sizeof(cpi.segment_feature_data)); | 56 memset(cpi.segment_feature_data, 0, sizeof(cpi.segment_feature_data)); |
| 57 | 57 |
| 58 // Segment map | 58 // Segment map |
| 59 cpi.segmentation_map = reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1)); | 59 cpi.segmentation_map = reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1)); |
| 60 | 60 |
| 61 // Allocate memory for the source memory map. | 61 // Allocate memory for the source memory map. |
| 62 unsigned char *roi_map = | 62 unsigned char *roi_map = |
| 63 reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1)); | 63 reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1)); |
| 64 vpx_memset(&roi_map[mbs >> 2], 1, (mbs >> 2)); | 64 memset(&roi_map[mbs >> 2], 1, (mbs >> 2)); |
| 65 vpx_memset(&roi_map[mbs >> 1], 2, (mbs >> 2)); | 65 memset(&roi_map[mbs >> 1], 2, (mbs >> 2)); |
| 66 vpx_memset(&roi_map[mbs -(mbs >> 2)], 3, (mbs >> 2)); | 66 memset(&roi_map[mbs -(mbs >> 2)], 3, (mbs >> 2)); |
| 67 | 67 |
| 68 // Do a test call with valid parameters. | 68 // Do a test call with valid parameters. |
| 69 int roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, | 69 int roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, |
| 70 cpi.common.mb_cols, delta_q, delta_lf, | 70 cpi.common.mb_cols, delta_q, delta_lf, |
| 71 threshold); | 71 threshold); |
| 72 EXPECT_EQ(0, roi_retval) | 72 EXPECT_EQ(0, roi_retval) |
| 73 << "vp8_set_roimap roi failed with default test parameters"; | 73 << "vp8_set_roimap roi failed with default test parameters"; |
| 74 | 74 |
| 75 // Check that the values in the cpi structure get set as expected. | 75 // Check that the values in the cpi structure get set as expected. |
| 76 if (roi_retval == 0) { | 76 if (roi_retval == 0) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 175 } |
| 176 | 176 |
| 177 // Free allocated memory | 177 // Free allocated memory |
| 178 if (cpi.segmentation_map) | 178 if (cpi.segmentation_map) |
| 179 vpx_free(cpi.segmentation_map); | 179 vpx_free(cpi.segmentation_map); |
| 180 if (roi_map) | 180 if (roi_map) |
| 181 vpx_free(roi_map); | 181 vpx_free(roi_map); |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 } // namespace | 184 } // namespace |
| OLD | NEW |