FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hap.h
Go to the documentation of this file.
1 /*
2  * Vidvox Hap
3  * Copyright (C) 2015 Vittorio Giovara <vittorio.giovara@gmail.com>
4  * Copyright (C) 2015 Tom Butterworth <bangnoise@gmail.com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef AVCODEC_HAP_H
24 #define AVCODEC_HAP_H
25 
26 #include <stdint.h>
27 
28 #include "libavutil/opt.h"
29 
30 #include "bytestream.h"
31 #include "texturedsp.h"
32 
37  HAP_FMT_RGTC1 = 0x01,
38 };
39 
41  HAP_COMP_NONE = 0xA0,
44 };
45 
51 };
52 
53 typedef struct HapChunk {
59 } HapChunk;
60 
61 typedef struct HapContext {
62  AVClass *class;
63 
66 
67  enum HapTextureFormat opt_tex_fmt; /* Texture type (encoder only) */
68  int opt_chunk_count; /* User-requested chunk count (encoder only) */
69  int opt_compressor; /* User-requested compressor (encoder only) */
70 
73  int *chunk_results; /* Results from threaded operations */
74 
75  int tex_rat; /* Compression ratio */
76  int tex_rat2; /* Compression ratio of the second texture */
77  const uint8_t *tex_data; /* Compressed texture */
78  uint8_t *tex_buf; /* Buffer for compressed texture */
79  size_t tex_size; /* Size of the compressed texture */
80 
81  size_t max_snappy; /* Maximum compressed size for snappy buffer */
82 
83  int slice_count; /* Number of slices for threaded operations */
84 
85  int texture_count; /* 2 for HAQA, 1 for other version */
86  int texture_section_size; /* size of the part of the texture section (for HAPQA) */
87  int uncompress_pix_size; /* nb of byte / pixel for the target picture */
88 
89  /* Pointer to the selected compress or decompress function */
90  int (*tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
91  int (*tex_fun2)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
92 } HapContext;
93 
94 /*
95  * Set the number of chunks in the frame. Returns 0 on success or an error if:
96  * - first_in_frame is 0 and the number of chunks has changed
97  * - any other error occurs
98  */
99 int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame);
100 
101 /*
102  * Free resources associated with the context
103  */
105 
106 /* The first three bytes are the size of the section past the header, or zero
107  * if the length is stored in the next long word. The fourth byte in the first
108  * long word indicates the type of the current section. */
109 int ff_hap_parse_section_header(GetByteContext *gbc, int *section_size,
110  enum HapSectionType *section_type);
111 
112 #endif /* AVCODEC_HAP_H */
Definition: hap.h:61
HapChunk * chunks
Definition: hap.h:72
HapSectionType
Definition: hap.h:46
int(* tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition: hap.h:90
int tex_rat2
Definition: hap.h:76
Texture block (4x4) module.
size_t compressed_size
Definition: hap.h:56
int compressed_offset
Definition: hap.h:55
HapCompressor
Definition: hap.h:40
size_t uncompressed_size
Definition: hap.h:58
static int16_t block[64]
Definition: dct.c:115
uint8_t
#define av_cold
Definition: attributes.h:82
AVOptions.
int opt_compressor
Definition: hap.h:69
TextureDSPContext dxtc
Definition: hap.h:64
GetByteContext gbc
Definition: hap.h:65
int * chunk_results
Definition: hap.h:73
int ff_hap_parse_section_header(GetByteContext *gbc, int *section_size, enum HapSectionType *section_type)
Definition: hap.c:57
int(* tex_fun2)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition: hap.h:91
int opt_chunk_count
Definition: hap.h:68
GLsizei count
Definition: opengl_enc.c:109
int uncompressed_offset
Definition: hap.h:57
AVFormatContext * ctx
Definition: movenc.c:48
size_t max_snappy
Definition: hap.h:81
int tex_rat
Definition: hap.h:75
const uint8_t * tex_data
Definition: hap.h:77
int chunk_count
Definition: hap.h:71
int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame)
Definition: hap.c:28
Describe the class of an AVClass context structure.
Definition: log.h:67
int slice_count
Definition: hap.h:83
enum HapTextureFormat opt_tex_fmt
Definition: hap.h:67
HapTextureFormat
Definition: hap.h:33
uint8_t * tex_buf
Definition: hap.h:78
int
size_t tex_size
Definition: hap.h:79
Definition: hap.h:53
int texture_section_size
Definition: hap.h:86
av_cold void ff_hap_free_context(HapContext *ctx)
Definition: hap.c:50
int uncompress_pix_size
Definition: hap.h:87
#define stride
enum HapCompressor compressor
Definition: hap.h:54
int texture_count
Definition: hap.h:85