xref: /rockchip-linux_mpp/mpp/codec/dec/av1/av1d_probs.c (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2021 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 #include "av1d_parser.h"
17 #include "av1d_common.h"
18 
Av1GetCDFs(AV1Context * ctx,RK_U32 ref_idx)19 void Av1GetCDFs(AV1Context *ctx, RK_U32 ref_idx)
20 {
21 
22     ctx->cdfs = &ctx->cdfs_last[ref_idx];
23     ctx->cdfs_ndvc = &ctx->cdfs_last_ndvc[ref_idx];
24 }
25 
Av1StoreCDFs(AV1Context * ctx,RK_U32 refresh_frame_flags)26 void Av1StoreCDFs(AV1Context *ctx, RK_U32 refresh_frame_flags)
27 {
28     RK_U32 i;
29 
30     for (i = 0; i < NUM_REF_FRAMES; i++) {
31         if (refresh_frame_flags & (1 << i)) {
32             if (&ctx->cdfs_last[i] != ctx->cdfs) {
33                 ctx->cdfs_last[i] = *ctx->cdfs;
34                 ctx->cdfs_last_ndvc[i] = *ctx->cdfs_ndvc;
35             }
36         }
37     }
38 }
39