a0fc2e0bf38d1215703e09d44b1a7cadb5049883
[libav.git] / libavcodec / hap.h
1 /*
2 * Vidvox Hap
3 * Copyright (C) 2015 Vittorio Giovara <vittorio.giovara@gmail.com>
4 *
5 * This file is part of Libav.
6 *
7 * Libav is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * Libav is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with Libav; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #ifndef AVCODEC_HAP_H
23 #define AVCODEC_HAP_H
24
25 #include <stdint.h>
26
27 #include "libavutil/opt.h"
28
29 #include "bytestream.h"
30 #include "texturedsp.h"
31
32 enum HapTextureFormat {
33 HAP_FMT_RGBDXT1 = 0x0B,
34 HAP_FMT_RGBADXT5 = 0x0E,
35 HAP_FMT_YCOCGDXT5 = 0x0F,
36 };
37
38 enum HapCompressor {
39 HAP_COMP_NONE = 0xA0,
40 HAP_COMP_SNAPPY = 0xB0,
41 HAP_COMP_COMPLEX = 0xC0,
42 };
43
44 typedef struct HapContext {
45 AVClass *class;
46
47 TextureDSPContext dxtc;
48 GetByteContext gbc;
49
50 int section_type; /* Header type */
51
52 int tex_rat; /* Compression ratio */
53 const uint8_t *tex_data; /* Compressed texture */
54 uint8_t *tex_buf; /* Uncompressed texture */
55 size_t tex_size; /* Size of the compressed texture */
56
57 uint8_t *snappied; /* Buffer interacting with snappy */
58 size_t max_snappy; /* Maximum compressed size for snappy buffer */
59
60 int slice_count; /* Number of slices for threaded operations */
61
62 /* Pointer to the selected compress or decompress function */
63 int (*tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
64 } HapContext;
65
66 #endif /* AVCODEC_HAP_H */