FFmpeg
Loading...
Searching...
No Matches
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 <stddef.h>
27#include <stdint.h>
28
29#include "bytestream.h"
30#include "texturedsp.h"
31
38
44
51
59
60typedef struct HapContext {
61 const struct AVClass *class;
62
64
65 /* enum HapTextureFormat, use int for AVOption */
66 int opt_tex_fmt; /* Texture type (encoder only) */
67 int opt_chunk_count; /* User-requested chunk count (encoder only) */
68 int opt_compressor; /* User-requested compressor (encoder only) */
69
72 int *chunk_results; /* Results from threaded operations */
73
74 uint8_t *tex_buf; /* Buffer for compressed texture */
75 size_t tex_size; /* Size of the compressed texture */
76
77 size_t max_snappy; /* Maximum compressed size for snappy buffer */
78
79 int texture_count; /* 2 for HAQA, 1 for other version */
80 int texture_section_size; /* size of the part of the texture section (for HAPQA) */
81
85
86/*
87 * Set the number of chunks in the frame. Returns 0 on success or an error if:
88 * - first_in_frame is 0 and the number of chunks has changed
89 * - any other error occurs
90 */
91int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame);
92
93/*
94 * Free resources associated with the context
95 */
97
98/* The first three bytes are the size of the section past the header, or zero
99 * if the length is stored in the next long word. The fourth byte in the first
100 * long word indicates the type of the current section. */
101int ff_hap_parse_section_header(GetByteContext *gbc, int *section_size,
102 enum HapSectionType *section_type);
103
104#endif /* AVCODEC_HAP_H */
static AVFormatContext * ctx
av_cold void ff_hap_free_context(HapContext *ctx)
Definition hap.c:51
int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame)
Definition hap.c:29
HapTextureFormat
Definition hap.h:32
@ HAP_FMT_RGBDXT1
Definition hap.h:33
@ HAP_FMT_YCOCGDXT5
Definition hap.h:35
@ HAP_FMT_RGBADXT5
Definition hap.h:34
@ HAP_FMT_RGTC1
Definition hap.h:36
int ff_hap_parse_section_header(GetByteContext *gbc, int *section_size, enum HapSectionType *section_type)
Definition hap.c:58
HapCompressor
Definition hap.h:39
@ HAP_COMP_NONE
Definition hap.h:40
@ HAP_COMP_SNAPPY
Definition hap.h:41
@ HAP_COMP_COMPLEX
Definition hap.h:42
HapSectionType
Definition hap.h:45
@ HAP_ST_SIZE_TABLE
Definition hap.h:48
@ HAP_ST_DECODE_INSTRUCTIONS
Definition hap.h:46
@ HAP_ST_COMPRESSOR_TABLE
Definition hap.h:47
@ HAP_ST_OFFSET_TABLE
Definition hap.h:49
#define av_cold
Definition attributes.h:117
Describe the class of an AVClass context structure.
Definition log.h:76
Definition hap.h:52
size_t compressed_size
Definition hap.h:55
uint32_t compressed_offset
Definition hap.h:54
int uncompressed_offset
Definition hap.h:56
size_t uncompressed_size
Definition hap.h:57
enum HapCompressor compressor
Definition hap.h:53
uint8_t * tex_buf
Definition hap.h:74
HapChunk * chunks
Definition hap.h:71
size_t tex_size
Definition hap.h:75
size_t max_snappy
Definition hap.h:77
int texture_count
Definition hap.h:79
TextureDSPThreadContext dec[2]
Definition hap.h:83
TextureDSPThreadContext enc
Definition hap.h:82
int * chunk_results
Definition hap.h:72
int opt_tex_fmt
Definition hap.h:66
int opt_chunk_count
Definition hap.h:67
int chunk_count
Definition hap.h:70
int opt_compressor
Definition hap.h:68
GetByteContext gbc
Definition hap.h:63
int texture_section_size
Definition hap.h:80
Texture block (4x4) module.