51     int is_first_table = 1, had_offsets = 0, had_compressors = 0, had_sizes = 0;
 
   62         switch (section_type) {
 
   67                 for (i = 0; i < section_size; i++) {
 
   77                 for (i = 0; i < section_size / 4; i++) {
 
   87                 for (i = 0; i < section_size / 4; i++) {
 
   99     if (!had_sizes || !had_compressors)
 
  105         size_t running_size = 0;
 
  118     size_t running_offset = 0;
 
  134     const char *compressorstr;
 
  148                "Invalid texture format %#04x.\n", section_type & 0x0F);
 
  152     switch (section_type & 0xF0) {
 
  162                 compressorstr = 
"none";
 
  164                 compressorstr = 
"snappy";
 
  173             compressorstr = 
"complex";
 
  199             int64_t uncompressed_size;
 
  203             if (uncompressed_size < 0) {
 
  204                 return uncompressed_size;
 
  221                                     int chunk_nb, 
int thread_nb)
 
  233         int64_t uncompressed_size = ctx->
tex_size;
 
  249                                               int slice, 
int thread_nb, 
int texture_num)
 
  257     int start_slice, end_slice;
 
  258     int base_blocks_per_slice = h_block / ctx->
slice_count;
 
  264     start_slice = slice * base_blocks_per_slice;
 
  266     start_slice += 
FFMIN(slice, remainder_blocks);
 
  268     end_slice = start_slice + base_blocks_per_slice;
 
  270     if (slice < remainder_blocks)
 
  273     for (y = start_slice; y < end_slice; y++) {
 
  275         int off  = y * w_block;
 
  276         for (x = 0; x < w_block; x++) {
 
  277             if (texture_num == 0) {
 
  291                                      int slice, 
int thread_nb)
 
  297                                       int slice, 
int thread_nb)
 
  311     int start_texture_section = 0;
 
  312     int tex_rat[2] = {0, 0};
 
  323         if ((section_type & 0x0F) != 0x0D) {
 
  324             av_log(avctx, 
AV_LOG_ERROR, 
"Invalid section type in 2 textures mode %#04x.\n", section_type);
 
  327         start_texture_section = 4;
 
  400     const char *texture_name;
 
  419     case MKTAG(
'H',
'a',
'p',
'1'):
 
  420         texture_name = 
"DXT1";
 
  425     case MKTAG(
'H',
'a',
'p',
'5'):
 
  426         texture_name = 
"DXT5";
 
  431     case MKTAG(
'H',
'a',
'p',
'Y'):
 
  432         texture_name = 
"DXT5-YCoCg-scaled";
 
  437     case MKTAG(
'H',
'a',
'p',
'A'):
 
  438         texture_name = 
"RGTC1";
 
  444     case MKTAG(
'H',
'a',
'p',
'M'):
 
  445         texture_name  = 
"DXT5-YCoCg-scaled / RGTC1";
 
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
 
const struct AVCodec * codec
 
#define AVERROR_INVALIDDATA
Invalid data found when processing input. 
 
This structure describes decoded (raw) audio or video data. 
 
static int hap_can_use_tex_in_place(HapContext *ctx)
 
ptrdiff_t const GLvoid * data
 
int coded_width
Bitstream width / height, may be different from width/height e.g. 
 
int(* dxt1_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 
int(* tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 
Texture block (4x4) module. 
 
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx. 
 
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
 
int ff_hap_parse_section_header(GetByteContext *gbc, int *section_size, enum HapSectionType *section_type)
 
int64_t ff_snappy_peek_uncompressed_length(GetByteContext *gb)
Get the uncompressed length of an input buffer compressed using the Snappy algorithm. 
 
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
 
int(* rgtc1u_gray_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined 
 
static int hap_parse_decode_instructions(HapContext *ctx, int size)
 
Multithreading support functions. 
 
int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame)
 
static av_cold int hap_init(AVCodecContext *avctx)
 
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
 
static int hap_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
 
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
 
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers. 
 
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
 
const char * name
Name of the codec implementation. 
 
int(* dxt5_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 
int(* tex_fun2)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 
static int decompress_texture_thread_internal(AVCodecContext *avctx, void *arg, int slice, int thread_nb, int texture_num)
 
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading. 
 
int ff_snappy_uncompress(GetByteContext *gb, uint8_t *buf, int64_t *size)
Decompress an input buffer using Snappy algorithm. 
 
packed RGBA 8:8:8:8, 32bpp, RGBARGBA... 
 
static av_cold int hap_close(AVCodecContext *avctx)
 
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
 
av_cold void ff_texturedsp_init(TextureDSPContext *c)
 
enum AVPictureType pict_type
Picture type of the frame. 
 
int width
picture width / height. 
 
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
 
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading. 
 
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer. 
 
Libavcodec external API header. 
 
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line. 
 
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs. 
 
av_cold void ff_hap_free_context(HapContext *ctx)
 
main external API structure. 
 
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). 
 
static int decompress_texture2_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb)
 
static int decompress_chunks_thread(AVCodecContext *avctx, void *arg, int chunk_nb, int thread_nb)
 
static int hap_parse_frame_header(AVCodecContext *avctx)
 
static int decompress_texture_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb)
 
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
 
common internal api header. 
 
int(* update_thread_context)(AVCodecContext *dst, const AVCodecContext *src)
Copy necessary context variables from a previous thread context to the current one. 
 
#define AVERROR_DECODER_NOT_FOUND
Decoder not found. 
 
int(* rgtc1u_alpha_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 
int(* execute2)(struct AVCodecContext *c, int(*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count)
The codec may call this to execute several independent things. 
 
int key_frame
1 -> keyframe, 0-> not 
 
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
 
enum HapCompressor compressor
 
#define MKTAG(a, b, c, d)
 
This structure stores compressed data. 
 
int(* dxt5ys_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
 
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.