]> git.sesse.net Git - ffmpeg/blob - libavcodec/hap.h
Hap decoder and encoder
[ffmpeg] / 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 typedef struct HapContext {
33     AVClass *class;
34
35     TextureDSPContext dxtc;
36     GetByteContext gbc;
37     PutByteContext pbc;
38
39     int section_type;        /* Header type */
40
41     int tex_rat;             /* Compression ratio */
42     const uint8_t *tex_data; /* Compressed texture */
43     uint8_t *tex_buf;        /* Uncompressed texture */
44     size_t tex_size;         /* Size of the compressed texture */
45
46     uint8_t *snappied;       /* Buffer interacting with snappy */
47     size_t max_snappy;       /* Maximum compressed size for snappy buffer */
48
49     /* Pointer to the selected compress or decompress function */
50     int (*tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
51 } HapContext;
52
53 enum {
54     HAP_FMT_RGBDXT1   = 0x0B,
55     HAP_FMT_RGBADXT5  = 0x0E,
56     HAP_FMT_YCOCGDXT5 = 0x0F,
57 };
58
59 enum {
60     HAP_COMP_NONE    = 0xA0,
61     HAP_COMP_SNAPPY  = 0xB0,
62     HAP_COMP_COMPLEX = 0xC0,
63 };
64
65 #endif /* AVCODEC_HAP_H */