Go to the documentation of this file.
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++) {
68 ctx->chunks[
i].compressor = bytestream2_get_byte(gbc) << 4;
77 for (
i = 0;
i < section_size / 4;
i++) {
78 ctx->chunks[
i].compressed_size = bytestream2_get_le32(gbc);
87 for (
i = 0;
i < section_size / 4;
i++) {
88 ctx->chunks[
i].compressed_offset = bytestream2_get_le32(gbc);
99 if (!had_sizes || !had_compressors)
105 size_t running_size = 0;
106 for (
i = 0;
i <
ctx->chunk_count;
i++) {
107 ctx->chunks[
i].compressed_offset = running_size;
108 running_size +=
ctx->chunks[
i].compressed_size;
118 size_t running_offset = 0;
119 for (
i = 0;
i <
ctx->chunk_count;
i++) {
120 if (
ctx->chunks[
i].compressed_offset != running_offset
123 running_offset +=
ctx->chunks[
i].compressed_size;
134 const char *compressorstr;
148 "Invalid texture format %#04x.\n", section_type & 0x0F);
152 switch (section_type & 0xF0) {
157 ctx->chunks[0].compressor = section_type & 0xF0;
158 ctx->chunks[0].compressed_offset = 0;
159 ctx->chunks[0].compressed_size =
ctx->texture_section_size;
162 compressorstr =
"none";
164 compressorstr =
"snappy";
173 compressorstr =
"complex";
185 for (
i = 0;
i <
ctx->chunk_count;
i++) {
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;
259 int remainder_blocks = 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) {
278 ctx->tex_fun(p +
x * 4 *
ctx->uncompress_pix_size,
frame->linesize[0],
279 d + (off +
x) *
ctx->tex_rat);
281 ctx->tex_fun2(p +
x * 4 *
ctx->uncompress_pix_size,
frame->linesize[0],
282 d + (off +
x) *
ctx->tex_rat2);
291 int slice,
int thread_nb)
297 int slice,
int thread_nb)
310 int start_texture_section = 0;
311 int tex_rat[2] = {0, 0};
315 tex_rat[0] =
ctx->tex_rat;
318 if (
ctx->texture_count == 2) {
322 if ((section_type & 0x0F) != 0x0D) {
323 av_log(avctx,
AV_LOG_ERROR,
"Invalid section type in 2 textures mode %#04x.\n", section_type);
326 start_texture_section = 4;
327 tex_rat[1] =
ctx->tex_rat2;
336 for (t = 0; t <
ctx->texture_count; t++) {
351 start_texture_section +=
ctx->texture_section_size + 4;
360 ctx->tex_data =
ctx->gbc.buffer;
375 ctx->chunk_results,
ctx->chunk_count);
377 for (
i = 0;
i <
ctx->chunk_count;
i++) {
378 if (
ctx->chunk_results[
i] < 0)
379 return ctx->chunk_results[
i];
382 ctx->tex_data =
ctx->tex_buf;
405 const char *texture_name;
420 ctx->texture_count = 1;
421 ctx->uncompress_pix_size = 4;
424 case MKTAG(
'H',
'a',
'p',
'1'):
425 texture_name =
"DXT1";
427 ctx->tex_fun =
ctx->dxtc.dxt1_block;
430 case MKTAG(
'H',
'a',
'p',
'5'):
431 texture_name =
"DXT5";
433 ctx->tex_fun =
ctx->dxtc.dxt5_block;
436 case MKTAG(
'H',
'a',
'p',
'Y'):
437 texture_name =
"DXT5-YCoCg-scaled";
439 ctx->tex_fun =
ctx->dxtc.dxt5ys_block;
442 case MKTAG(
'H',
'a',
'p',
'A'):
443 texture_name =
"RGTC1";
445 ctx->tex_fun =
ctx->dxtc.rgtc1u_gray_block;
447 ctx->uncompress_pix_size = 1;
449 case MKTAG(
'H',
'a',
'p',
'M'):
450 texture_name =
"DXT5-YCoCg-scaled / RGTC1";
453 ctx->tex_fun =
ctx->dxtc.dxt5ys_block;
454 ctx->tex_fun2 =
ctx->dxtc.rgtc1u_alpha_block;
456 ctx->texture_count = 2;
492 .codec_tags = (
const uint32_t []){
493 MKTAG(
'H',
'a',
'p',
'1'),
494 MKTAG(
'H',
'a',
'p',
'5'),
495 MKTAG(
'H',
'a',
'p',
'Y'),
496 MKTAG(
'H',
'a',
'p',
'A'),
497 MKTAG(
'H',
'a',
'p',
'M'),
#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(* update_thread_context)(struct AVCodecContext *dst, const struct AVCodecContext *src)
Copy necessary context variables from a previous thread context to the current one.
#define MKTAG(a, b, c, d)
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
This structure describes decoded (raw) audio or video data.
int ff_hap_parse_section_header(GetByteContext *gbc, int *section_size, enum HapSectionType *section_type)
static int hap_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
const struct AVCodec * codec
static int hap_parse_decode_instructions(HapContext *ctx, int size)
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have so the codec calls ff_thread_report set FF_CODEC_CAP_ALLOCATE_PROGRESS in AVCodec caps_internal and use ff_thread_get_buffer() to allocate frames. The frames must then be freed with ff_thread_release_buffer(). Otherwise decode directly into the user-supplied frames. Call ff_thread_report_progress() after some part of the current picture has decoded. A good place to put this is where draw_horiz_band() is called - add this if it isn 't called anywhere
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
int key_frame
1 -> keyframe, 0-> not
static av_cold int hap_close(AVCodecContext *avctx)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_CODEC_TAGS_END
AVCodec.codec_tags termination value.
av_cold void ff_hap_free_context(HapContext *ctx)
static av_cold int hap_init(AVCodecContext *avctx)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
av_cold void ff_texturedsp_init(TextureDSPContext *c)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
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.
static int decompress_chunks_thread(AVCodecContext *avctx, void *arg, int chunk_nb, int thread_nb)
@ AV_PICTURE_TYPE_I
Intra.
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
@ HAP_ST_DECODE_INSTRUCTIONS
int ff_hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
enum AVPictureType pict_type
Picture type of the frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
enum HapCompressor compressor
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
@ HAP_ST_COMPRESSOR_TABLE
static int decompress_texture_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb)
#define i(width, name, range_min, range_max)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call ff_thread_finish_setup() afterwards. If some code can 't be moved
main external API structure.
static int decompress_texture2_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb)
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
int coded_width
Bitstream width / height, may be different from width/height e.g.
int64_t ff_snappy_peek_uncompressed_length(GetByteContext *gb)
Get the uncompressed length of an input buffer compressed using the Snappy algorithm.
static int hap_can_use_tex_in_place(HapContext *ctx)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
This structure stores compressed data.
int ff_snappy_uncompress(GetByteContext *gb, uint8_t *buf, int64_t *size)
Decompress an input buffer using Snappy algorithm.
int width
picture width / height.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
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...
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.
static int hap_parse_frame_header(AVCodecContext *avctx)