FFmpeg  3.4.9
hapdec.c
Go to the documentation of this file.
1 /*
2  * Vidvox Hap decoder
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 /**
24  * @file
25  * Hap decoder
26  *
27  * Fourcc: Hap1, Hap5, HapY, HapA, HapM
28  *
29  * https://github.com/Vidvox/hap/blob/master/documentation/HapVideoDRAFT.md
30  */
31 
32 #include <stdint.h>
33 
34 #include "libavutil/imgutils.h"
35 
36 #include "avcodec.h"
37 #include "bytestream.h"
38 #include "hap.h"
39 #include "internal.h"
40 #include "snappy.h"
41 #include "texturedsp.h"
42 #include "thread.h"
43 
44 /* The first three bytes are the size of the section past the header, or zero
45  * if the length is stored in the next long word. The fourth byte in the first
46  * long word indicates the type of the current section. */
47 static int parse_section_header(GetByteContext *gbc, int *section_size,
48  enum HapSectionType *section_type)
49 {
50  if (bytestream2_get_bytes_left(gbc) < 4)
51  return AVERROR_INVALIDDATA;
52 
53  *section_size = bytestream2_get_le24(gbc);
54  *section_type = bytestream2_get_byte(gbc);
55 
56  if (*section_size == 0) {
57  if (bytestream2_get_bytes_left(gbc) < 4)
58  return AVERROR_INVALIDDATA;
59 
60  *section_size = bytestream2_get_le32(gbc);
61  }
62 
63  if (*section_size > bytestream2_get_bytes_left(gbc) || *section_size < 0)
64  return AVERROR_INVALIDDATA;
65  else
66  return 0;
67 }
68 
70 {
71  GetByteContext *gbc = &ctx->gbc;
72  int section_size;
73  enum HapSectionType section_type;
74  int is_first_table = 1, had_offsets = 0, had_compressors = 0, had_sizes = 0;
75  int i, ret;
76 
77  while (size > 0) {
78  int stream_remaining = bytestream2_get_bytes_left(gbc);
79  ret = parse_section_header(gbc, &section_size, &section_type);
80  if (ret != 0)
81  return ret;
82 
83  size -= stream_remaining - bytestream2_get_bytes_left(gbc);
84 
85  switch (section_type) {
87  ret = ff_hap_set_chunk_count(ctx, section_size, is_first_table);
88  if (ret != 0)
89  return ret;
90  for (i = 0; i < section_size; i++) {
91  ctx->chunks[i].compressor = bytestream2_get_byte(gbc) << 4;
92  }
93  had_compressors = 1;
94  is_first_table = 0;
95  break;
96  case HAP_ST_SIZE_TABLE:
97  ret = ff_hap_set_chunk_count(ctx, section_size / 4, is_first_table);
98  if (ret != 0)
99  return ret;
100  for (i = 0; i < section_size / 4; i++) {
101  ctx->chunks[i].compressed_size = bytestream2_get_le32(gbc);
102  }
103  had_sizes = 1;
104  is_first_table = 0;
105  break;
106  case HAP_ST_OFFSET_TABLE:
107  ret = ff_hap_set_chunk_count(ctx, section_size / 4, is_first_table);
108  if (ret != 0)
109  return ret;
110  for (i = 0; i < section_size / 4; i++) {
111  ctx->chunks[i].compressed_offset = bytestream2_get_le32(gbc);
112  }
113  had_offsets = 1;
114  is_first_table = 0;
115  break;
116  default:
117  break;
118  }
119  size -= section_size;
120  }
121 
122  if (!had_sizes || !had_compressors)
123  return AVERROR_INVALIDDATA;
124 
125  /* The offsets table is optional. If not present than calculate offsets by
126  * summing the sizes of preceding chunks. */
127  if (!had_offsets) {
128  size_t running_size = 0;
129  for (i = 0; i < ctx->chunk_count; i++) {
130  ctx->chunks[i].compressed_offset = running_size;
131  if (ctx->chunks[i].compressed_size > UINT32_MAX - running_size)
132  return AVERROR_INVALIDDATA;
133  running_size += ctx->chunks[i].compressed_size;
134  }
135  }
136 
137  return 0;
138 }
139 
141 {
142  int i;
143  size_t running_offset = 0;
144  for (i = 0; i < ctx->chunk_count; i++) {
145  if (ctx->chunks[i].compressed_offset != running_offset
146  || ctx->chunks[i].compressor != HAP_COMP_NONE)
147  return 0;
148  running_offset += ctx->chunks[i].compressed_size;
149  }
150  return 1;
151 }
152 
154 {
155  HapContext *ctx = avctx->priv_data;
156  GetByteContext *gbc = &ctx->gbc;
157  int section_size;
158  enum HapSectionType section_type;
159  const char *compressorstr;
160  int i, ret;
161 
162  ret = parse_section_header(gbc, &section_size, &section_type);
163  if (ret != 0)
164  return ret;
165 
166  if ((avctx->codec_tag == MKTAG('H','a','p','1') && (section_type & 0x0F) != HAP_FMT_RGBDXT1) ||
167  (avctx->codec_tag == MKTAG('H','a','p','5') && (section_type & 0x0F) != HAP_FMT_RGBADXT5) ||
168  (avctx->codec_tag == MKTAG('H','a','p','Y') && (section_type & 0x0F) != HAP_FMT_YCOCGDXT5) ||
169  (avctx->codec_tag == MKTAG('H','a','p','A') && (section_type & 0x0F) != HAP_FMT_RGTC1)) {
170  av_log(avctx, AV_LOG_ERROR,
171  "Invalid texture format %#04x.\n", section_type & 0x0F);
172  return AVERROR_INVALIDDATA;
173  }
174 
175  switch (section_type & 0xF0) {
176  case HAP_COMP_NONE:
177  case HAP_COMP_SNAPPY:
178  ret = ff_hap_set_chunk_count(ctx, 1, 1);
179  if (ret == 0) {
180  ctx->chunks[0].compressor = section_type & 0xF0;
181  ctx->chunks[0].compressed_offset = 0;
182  ctx->chunks[0].compressed_size = section_size;
183  }
184  if (ctx->chunks[0].compressor == HAP_COMP_NONE) {
185  compressorstr = "none";
186  } else {
187  compressorstr = "snappy";
188  }
189  break;
190  case HAP_COMP_COMPLEX:
191  ret = parse_section_header(gbc, &section_size, &section_type);
192  if (ret == 0 && section_type != HAP_ST_DECODE_INSTRUCTIONS)
193  ret = AVERROR_INVALIDDATA;
194  if (ret == 0)
195  ret = hap_parse_decode_instructions(ctx, section_size);
196  compressorstr = "complex";
197  break;
198  default:
199  ret = AVERROR_INVALIDDATA;
200  break;
201  }
202 
203  if (ret != 0)
204  return ret;
205 
206  /* Check the frame is valid and read the uncompressed chunk sizes */
207  ctx->tex_size = 0;
208  for (i = 0; i < ctx->chunk_count; i++) {
209  HapChunk *chunk = &ctx->chunks[i];
210 
211  /* Check the compressed buffer is valid */
212  if (chunk->compressed_offset + (uint64_t)chunk->compressed_size > bytestream2_get_bytes_left(gbc))
213  return AVERROR_INVALIDDATA;
214 
215  /* Chunks are unpacked sequentially, ctx->tex_size is the uncompressed
216  * size thus far */
217  chunk->uncompressed_offset = ctx->tex_size;
218 
219  /* Fill out uncompressed size */
220  if (chunk->compressor == HAP_COMP_SNAPPY) {
221  GetByteContext gbc_tmp;
222  int64_t uncompressed_size;
223  bytestream2_init(&gbc_tmp, gbc->buffer + chunk->compressed_offset,
224  chunk->compressed_size);
225  uncompressed_size = ff_snappy_peek_uncompressed_length(&gbc_tmp);
226  if (uncompressed_size < 0) {
227  return uncompressed_size;
228  }
229  chunk->uncompressed_size = uncompressed_size;
230  } else if (chunk->compressor == HAP_COMP_NONE) {
231  chunk->uncompressed_size = chunk->compressed_size;
232  } else {
233  return AVERROR_INVALIDDATA;
234  }
235  ctx->tex_size += chunk->uncompressed_size;
236  }
237 
238  av_log(avctx, AV_LOG_DEBUG, "%s compressor\n", compressorstr);
239 
240  return ret;
241 }
242 
243 static int decompress_chunks_thread(AVCodecContext *avctx, void *arg,
244  int chunk_nb, int thread_nb)
245 {
246  HapContext *ctx = avctx->priv_data;
247 
248  HapChunk *chunk = &ctx->chunks[chunk_nb];
249  GetByteContext gbc;
250  uint8_t *dst = ctx->tex_buf + chunk->uncompressed_offset;
251 
252  bytestream2_init(&gbc, ctx->gbc.buffer + chunk->compressed_offset, chunk->compressed_size);
253 
254  if (chunk->compressor == HAP_COMP_SNAPPY) {
255  int ret;
256  int64_t uncompressed_size = ctx->tex_size;
257 
258  /* Uncompress the frame */
259  ret = ff_snappy_uncompress(&gbc, dst, &uncompressed_size);
260  if (ret < 0) {
261  av_log(avctx, AV_LOG_ERROR, "Snappy uncompress error\n");
262  return ret;
263  }
264  } else if (chunk->compressor == HAP_COMP_NONE) {
265  bytestream2_get_buffer(&gbc, dst, chunk->compressed_size);
266  }
267 
268  return 0;
269 }
270 
272  int slice, int thread_nb)
273 {
274  HapContext *ctx = avctx->priv_data;
275  AVFrame *frame = arg;
276  const uint8_t *d = ctx->tex_data;
277  int w_block = avctx->coded_width / TEXTURE_BLOCK_W;
278  int h_block = avctx->coded_height / TEXTURE_BLOCK_H;
279  int x, y;
280  int start_slice, end_slice;
281  int base_blocks_per_slice = h_block / ctx->slice_count;
282  int remainder_blocks = h_block % ctx->slice_count;
283 
284  /* When the frame height (in blocks) doesn't divide evenly between the
285  * number of slices, spread the remaining blocks evenly between the first
286  * operations */
287  start_slice = slice * base_blocks_per_slice;
288  /* Add any extra blocks (one per slice) that have been added before this slice */
289  start_slice += FFMIN(slice, remainder_blocks);
290 
291  end_slice = start_slice + base_blocks_per_slice;
292  /* Add an extra block if there are still remainder blocks to be accounted for */
293  if (slice < remainder_blocks)
294  end_slice++;
295 
296  for (y = start_slice; y < end_slice; y++) {
297  uint8_t *p = frame->data[0] + y * frame->linesize[0] * TEXTURE_BLOCK_H;
298  int off = y * w_block;
299  for (x = 0; x < w_block; x++) {
300  ctx->tex_fun(p + x * 16, frame->linesize[0],
301  d + (off + x) * ctx->tex_rat);
302  }
303  }
304 
305  return 0;
306 }
307 
308 static int hap_decode(AVCodecContext *avctx, void *data,
309  int *got_frame, AVPacket *avpkt)
310 {
311  HapContext *ctx = avctx->priv_data;
312  ThreadFrame tframe;
313  int ret, i;
314  int tex_size;
315 
316  bytestream2_init(&ctx->gbc, avpkt->data, avpkt->size);
317 
318  /* Check for section header */
319  ret = hap_parse_frame_header(avctx);
320  if (ret < 0)
321  return ret;
322 
323  /* Get the output frame ready to receive data */
324  tframe.f = data;
325  ret = ff_thread_get_buffer(avctx, &tframe, 0);
326  if (ret < 0)
327  return ret;
328  if (avctx->codec->update_thread_context)
329  ff_thread_finish_setup(avctx);
330 
331  /* Unpack the DXT texture */
332  if (hap_can_use_tex_in_place(ctx)) {
333  /* Only DXTC texture compression in a contiguous block */
334  ctx->tex_data = ctx->gbc.buffer;
335  tex_size = bytestream2_get_bytes_left(&ctx->gbc);
336  } else {
337  /* Perform the second-stage decompression */
338  ret = av_reallocp(&ctx->tex_buf, ctx->tex_size);
339  if (ret < 0)
340  return ret;
341 
342  avctx->execute2(avctx, decompress_chunks_thread, NULL,
343  ctx->chunk_results, ctx->chunk_count);
344 
345  for (i = 0; i < ctx->chunk_count; i++) {
346  if (ctx->chunk_results[i] < 0)
347  return ctx->chunk_results[i];
348  }
349 
350  ctx->tex_data = ctx->tex_buf;
351  tex_size = ctx->tex_size;
352  }
353 
354  if (tex_size < (avctx->coded_width / TEXTURE_BLOCK_W)
355  *(avctx->coded_height / TEXTURE_BLOCK_H)
356  *ctx->tex_rat) {
357  av_log(avctx, AV_LOG_ERROR, "Insufficient data\n");
358  return AVERROR_INVALIDDATA;
359  }
360 
361  /* Use the decompress function on the texture, one block per thread */
362  avctx->execute2(avctx, decompress_texture_thread, tframe.f, NULL, ctx->slice_count);
363 
364  /* Frame is ready to be output */
365  tframe.f->pict_type = AV_PICTURE_TYPE_I;
366  tframe.f->key_frame = 1;
367  *got_frame = 1;
368 
369  return avpkt->size;
370 }
371 
372 static av_cold int hap_init(AVCodecContext *avctx)
373 {
374  HapContext *ctx = avctx->priv_data;
375  const char *texture_name;
376  int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
377 
378  if (ret < 0) {
379  av_log(avctx, AV_LOG_ERROR, "Invalid video size %dx%d.\n",
380  avctx->width, avctx->height);
381  return ret;
382  }
383 
384  /* Since codec is based on 4x4 blocks, size is aligned to 4 */
385  avctx->coded_width = FFALIGN(avctx->width, TEXTURE_BLOCK_W);
386  avctx->coded_height = FFALIGN(avctx->height, TEXTURE_BLOCK_H);
387 
388  ff_texturedsp_init(&ctx->dxtc);
389 
390  switch (avctx->codec_tag) {
391  case MKTAG('H','a','p','1'):
392  texture_name = "DXT1";
393  ctx->tex_rat = 8;
394  ctx->tex_fun = ctx->dxtc.dxt1_block;
395  avctx->pix_fmt = AV_PIX_FMT_RGB0;
396  break;
397  case MKTAG('H','a','p','5'):
398  texture_name = "DXT5";
399  ctx->tex_rat = 16;
400  ctx->tex_fun = ctx->dxtc.dxt5_block;
401  avctx->pix_fmt = AV_PIX_FMT_RGBA;
402  break;
403  case MKTAG('H','a','p','Y'):
404  texture_name = "DXT5-YCoCg-scaled";
405  ctx->tex_rat = 16;
406  ctx->tex_fun = ctx->dxtc.dxt5ys_block;
407  avctx->pix_fmt = AV_PIX_FMT_RGB0;
408  break;
409  case MKTAG('H','a','p','A'):
410  texture_name = "RGTC1";
411  ctx->tex_rat = 8;
412  ctx->tex_fun = ctx->dxtc.rgtc1u_block;
413  avctx->pix_fmt = AV_PIX_FMT_RGB0;
414  break;
415  case MKTAG('H','a','p','M'):
416  avpriv_report_missing_feature(avctx, "HapQAlpha");
417  return AVERROR_PATCHWELCOME;
418  default:
420  }
421 
422  av_log(avctx, AV_LOG_DEBUG, "%s texture\n", texture_name);
423 
424  ctx->slice_count = av_clip(avctx->thread_count, 1,
425  avctx->coded_height / TEXTURE_BLOCK_H);
426 
427  return 0;
428 }
429 
430 static av_cold int hap_close(AVCodecContext *avctx)
431 {
432  HapContext *ctx = avctx->priv_data;
433 
434  ff_hap_free_context(ctx);
435 
436  return 0;
437 }
438 
440  .name = "hap",
441  .long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap"),
442  .type = AVMEDIA_TYPE_VIDEO,
443  .id = AV_CODEC_ID_HAP,
444  .init = hap_init,
445  .decode = hap_decode,
446  .close = hap_close,
447  .priv_data_size = sizeof(HapContext),
450  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
452 };
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:48
Definition: hap.h:61
#define NULL
Definition: coverity.c:32
const struct AVCodec * codec
Definition: avcodec.h:1770
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
int size
int(* dxt5_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition: texturedsp.h:51
This structure describes decoded (raw) audio or video data.
Definition: frame.h:201
HapChunk * chunks
Definition: hap.h:72
static int hap_can_use_tex_in_place(HapContext *ctx)
Definition: hapdec.c:140
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:1963
HapSectionType
Definition: hap.h:46
misc image utilities
AVFrame * f
Definition: thread.h:36
Texture block (4x4) module.
int size
Definition: avcodec.h:1680
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1989
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:133
size_t compressed_size
Definition: hap.h:56
AVCodec.
Definition: avcodec.h:3739
size_t uncompressed_size
Definition: hap.h:58
int64_t ff_snappy_peek_uncompressed_length(GetByteContext *gb)
Get the uncompressed length of an input buffer compressed using the Snappy algorithm.
Definition: snappy.c:133
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
uint8_t
#define av_cold
Definition: attributes.h:82
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:256
static int hap_parse_decode_instructions(HapContext *ctx, int size)
Definition: hapdec.c:69
Multithreading support functions.
AVCodec ff_hap_decoder
Definition: hapdec.c:439
int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame)
Definition: hap.c:28
static AVFrame * frame
#define TEXTURE_BLOCK_H
Definition: texturedsp.h:43
const char data[16]
Definition: mxf.c:90
TextureDSPContext dxtc
Definition: hap.h:64
uint8_t * data
Definition: avcodec.h:1679
const uint8_t * buffer
Definition: bytestream.h:34
static av_cold int hap_init(AVCodecContext *avctx)
Definition: hapdec.c:372
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...
#define FFALIGN(x, a)
Definition: macros.h:48
GetByteContext gbc
Definition: hap.h:65
#define av_log(a,...)
static int hap_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: hapdec.c:308
int(* dxt5ys_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition: texturedsp.h:53
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
uint32_t compressed_offset
Definition: hap.h:55
int * chunk_results
Definition: hap.h:73
int(* rgtc1u_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition: texturedsp.h:55
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:181
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
Definition: bytestream.h:263
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:154
const char * arg
Definition: jacosubdec.c:66
const char * name
Name of the codec implementation.
Definition: avcodec.h:3746
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1065
int ff_snappy_uncompress(GetByteContext *gb, uint8_t *buf, int64_t *size)
Decompress an input buffer using Snappy algorithm.
Definition: snappy.c:143
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:98
static av_cold int hap_close(AVCodecContext *avctx)
Definition: hapdec.c:430
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...
Definition: imgutils.c:281
av_cold void ff_texturedsp_init(TextureDSPContext *c)
Definition: texturedsp.c:599
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:284
int uncompressed_offset
Definition: hap.h:57
#define FFMIN(a, b)
Definition: common.h:96
int width
picture width / height.
Definition: avcodec.h:1948
static int parse_section_header(GetByteContext *gbc, int *section_size, enum HapSectionType *section_type)
Definition: hapdec.c:47
AVFormatContext * ctx
Definition: movenc.c:48
int tex_rat
Definition: hap.h:75
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
Definition: avcodec.h:3192
Snappy decompression.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
Definition: avcodec.h:1069
int(* update_thread_context)(AVCodecContext *dst, const AVCodecContext *src)
Copy necessary context variables from a previous thread context to the current one.
Definition: avcodec.h:3794
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.
Definition: avcodec.h:3252
int(* tex_fun)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition: hap.h:85
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
Definition: mem.c:163
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:232
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)
Definition: hap.c:50
main external API structure.
Definition: avcodec.h:1761
const uint8_t * tex_data
Definition: hap.h:76
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> (&#39;D&#39;<<24) + (&#39;C&#39;<<16) + (&#39;B&#39;<<8) + &#39;A&#39;).
Definition: avcodec.h:1793
int chunk_count
Definition: hap.h:71
int(* dxt1_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition: texturedsp.h:46
int coded_height
Definition: avcodec.h:1963
int slice_count
Definition: hap.h:82
static int decompress_chunks_thread(AVCodecContext *avctx, void *arg, int chunk_nb, int thread_nb)
Definition: hapdec.c:243
static int hap_parse_frame_header(AVCodecContext *avctx)
Definition: hapdec.c:153
static int decompress_texture_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb)
Definition: hapdec.c:271
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
uint8_t * tex_buf
Definition: hap.h:77
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:215
common internal api header.
size_t tex_size
Definition: hap.h:78
Definition: hap.h:53
void * priv_data
Definition: avcodec.h:1803
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
Definition: error.h:52
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:279
enum HapCompressor compressor
Definition: hap.h:54
#define MKTAG(a, b, c, d)
Definition: common.h:342
#define TEXTURE_BLOCK_W
Definition: texturedsp.h:42
This structure stores compressed data.
Definition: avcodec.h:1656
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:1002