xref: /rockchip-linux_mpp/mpp/base/test/mpp_dec_cfg_test.c (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2020 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_dec_cfg_test"
18 
19 #include "mpp_log.h"
20 #include "mpp_mem.h"
21 #include "mpp_time.h"
22 #include "mpp_common.h"
23 
24 #include "rk_vdec_cfg.h"
25 #include "mpp_dec_cfg.h"
26 
main()27 int main()
28 {
29     MPP_RET ret = MPP_OK;
30     MppDecCfg cfg;
31     RK_S64 end = 0;
32     RK_S64 start = 0;
33 
34     mpp_dec_cfg_show();
35 
36     mpp_log("mpp_dec_cfg_test start\n");
37 
38     ret = mpp_dec_cfg_init(&cfg);
39     if (ret) {
40         mpp_err("mpp_dec_cfg_init failed\n");
41         goto DONE;
42     }
43 
44     RK_S32 fast_out = 1;
45 
46     MppDecCfgSet *impl = (MppDecCfgSet *)cfg;
47 
48     mpp_log("before set: fast_out %d\n", impl->base.fast_out);
49 
50     start = mpp_time();
51     ret = mpp_dec_cfg_set_u32(cfg, "base:fast_out", fast_out);
52     end = mpp_time();
53     mpp_log("set u32 time %lld us\n", end - start);
54 
55     mpp_log("after  get: fast_out %d\n", fast_out);
56 
57     ret = mpp_dec_cfg_deinit(cfg);
58     if (ret) {
59         mpp_err("mpp_dec_cfg_deinit failed\n");
60         goto DONE;
61     }
62 
63 DONE:
64     mpp_log("mpp_dec_cfg_test done %s\n", ret ? "failed" : "success");
65     return ret;
66 }
67