1 /*
2 * Copyright 2015 Rockchip Electronics Co. LTD
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #define MODULE_TAG "mpp_rc_test"
18
19 #include <stdlib.h>
20
21 #include "mpp_log.h"
22 #include "rc_base.h"
23
main()24 int main()
25 {
26 MPP_RET ret = MPP_OK;
27 MppDataV2 *data_2 = NULL;
28 MppDataV2 *data_5 = NULL;
29 MppDataV2 *data_8 = NULL;
30 MppDataV2 *data_30 = NULL;
31 RK_S32 val = 0;
32 RK_S32 i;
33
34 mpp_log("mpp rc test start\n");
35
36 mpp_data_init_v2(&data_2, 2, 0);
37 mpp_data_init_v2(&data_5, 5, 0);
38 mpp_data_init_v2(&data_8, 8, 0);
39 mpp_data_init_v2(&data_30, 30, 0);
40
41 for (i = 0; i < 50; i++) {
42 val = i;
43
44 mpp_data_update_v2(data_2, val);
45 mpp_data_update_v2(data_5, val);
46 mpp_data_update_v2(data_8, val);
47 mpp_data_update_v2(data_30, val);
48
49 mpp_log("sum %4d %4d %4d %4d mean %2d %2d %2d %2d ratio sum %2d %2d %2d %2d\n",
50 mpp_data_sum_v2(data_2), mpp_data_sum_v2(data_5),
51 mpp_data_sum_v2(data_8), mpp_data_sum_v2(data_30),
52 mpp_data_mean_v2(data_2), mpp_data_mean_v2(data_5),
53 mpp_data_mean_v2(data_8), mpp_data_mean_v2(data_30),
54 mpp_data_sum_with_ratio_v2(data_2, data_2->size, 3, 4),
55 mpp_data_sum_with_ratio_v2(data_5, data_5->size, 3, 4),
56 mpp_data_sum_with_ratio_v2(data_8, data_8->size, 3, 4),
57 mpp_data_sum_with_ratio_v2(data_30, data_30->size, 3, 4));
58 }
59
60 mpp_data_deinit_v2(data_5);
61 mpp_data_deinit_v2(data_8);
62 mpp_data_deinit_v2(data_30);
63 mpp_data_deinit_v2(data_2);
64
65 mpp_log("mpp rc test success\n");
66
67 return ret;
68 }
69
70