• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __LZMARAM_H__
17 #define __LZMARAM_H__
18 
19 #include <hi_types.h>
20 
21 typedef hi_u32 (*lzma_stream_fct)(hi_u32 offset, hi_u8 *buffer, hi_u32 size);
22 
23 typedef struct {
24     hi_u32 offset;
25     lzma_stream_fct func;
26 } lzma_stream;
27 
28 typedef struct {
29     hi_pbyte (*alloc)(hi_pbyte p, unsigned int size);
30     void (*free)(hi_pbyte p, hi_pbyte address); /* address can be 0 */
31 } i_sz_alloc;
32 
33 extern unsigned int LzmaDecode2(const unsigned char *prop_data, unsigned int prop_size, hi_u32 *status,
34                                 i_sz_alloc *alloc, lzma_stream *in_stream, lzma_stream *out_stream,
35                                 unsigned int uncompress_len, unsigned int compress_len);
36 
37 unsigned int hi_lzma_decompress(const hi_u8 lzma_head[13], hi_u32 head_size,  /* head 13B */
38                                 unsigned int compress_len,
39                                 lzma_stream_fct in_func, lzma_stream_fct out_func);
40 unsigned int hi_lzma_get_uncompress_len(const hi_u8 lzma_head[13], hi_u32 head_size, /* head 13B */
41                                         unsigned int *pul_decompressed_data_len, unsigned int *dic_size);
42 unsigned int hi_lzma_mem_detect(const hi_u8 lzma_head[13], hi_u32 head_size); /* head 13B */
43 
44 #endif
45 
46