Go to the documentation of this file.
41 #define VP6_MAX_HUFF_SIZE 12
49 int parse_filter_info = 0;
56 int separated_coeff = buf[0] & 1;
62 sub_version = buf[1] >> 3;
65 s->filter_header = buf[1] & 0x06;
70 if (separated_coeff || !
s->filter_header) {
71 coeff_offset =
AV_RB16(buf+2) - 2;
85 if (!
s->macroblocks ||
86 16*cols !=
s->avctx->coded_width ||
87 16*rows !=
s->avctx->coded_height) {
88 if (
s->avctx->extradata_size == 0 &&
89 FFALIGN(
s->avctx->width, 16) == 16 * cols &&
90 FFALIGN(
s->avctx->height, 16) == 16 * rows) {
94 s->avctx->coded_width = 16 * cols;
95 s->avctx->coded_height = 16 * rows;
101 if (
s->avctx->extradata_size == 1) {
102 s->avctx->width -=
s->avctx->extradata[0] >> 4;
103 s->avctx->height -=
s->avctx->extradata[0] & 0x0F;
114 parse_filter_info =
s->filter_header;
117 s->sub_version = sub_version;
120 if (!
s->sub_version || !
s->avctx->coded_width || !
s->avctx->coded_height)
123 if (separated_coeff || !
s->filter_header) {
124 coeff_offset =
AV_RB16(buf+1) - 2;
133 if (
s->filter_header) {
135 if (
s->deblock_filtering)
137 if (
s->sub_version > 7)
142 if (parse_filter_info) {
152 if (
s->sub_version > 7)
155 s->filter_selection = 16;
163 buf_size -= coeff_offset;
168 if (
s->use_huffman) {
192 s->modelp->coeff_index_to_pos[0] = 0;
195 if (
s->modelp->coeff_reorder[
pos] ==
i)
196 s->modelp->coeff_index_to_pos[idx++] =
pos;
198 for (idx = 0; idx < 64; idx++) {
200 for (
i = 0;
i <= idx;
i++) {
201 int v =
s->modelp->coeff_index_to_pos[
i];
205 if (
s->sub_version > 6)
207 s->modelp->coeff_index_to_idct_selector[idx] =
max;
243 for (node=0; node<7; node++)
248 for (node=0; node<8; node++)
256 const Node *
a = va, *
b = vb;
257 return (
a->count -
b->count)*16 + (
b->sym -
a->sym);
269 a =
tmp[
i].count * coeff_model[
i] >> 8;
270 b =
tmp[
i].count * (255 - coeff_model[
i]) >> 8;
291 memset(def_prob, 0x80,
sizeof(def_prob));
294 for (node=0; node<11; node++)
309 for (cg=0; cg<2; cg++)
310 for (node=0; node<14; node++)
314 for (ct=0; ct<3; ct++)
316 for (cg=0; cg<6; cg++)
317 for (node=0; node<11; node++)
325 if (
s->use_huffman) {
333 for (ct=0; ct<3; ct++)
334 for (cg = 0; cg < 6; cg++)
337 &
s->ract_vlc[
pt][ct][cg]))
340 memset(
s->nb_null, 0,
sizeof(
s->nb_null));
345 for (node=0; node<5; node++)
358 if (
s->vector_candidate_pos < 2)
359 *vect =
s->vector_candidate[0];
365 static const uint8_t prob_order[] = {0, 1, 2, 7, 6, 5, 4};
366 for (
i=0;
i<
sizeof(prob_order);
i++) {
367 int j = prob_order[
i];
410 int coeff, sign, coeff_idx;
414 for (
b=0;
b<6;
b++) {
417 vlc_coeff = &
s->dccv_vlc[
pt];
419 for (coeff_idx = 0;;) {
421 if (coeff_idx<2 && s->nb_null[coeff_idx][
pt]) {
422 s->nb_null[coeff_idx][
pt]--;
431 int pt = (coeff_idx >= 6);
438 }
else if (
coeff == 11) {
446 ct = 1 + (coeff2 > 1);
448 coeff2 = (coeff2 ^ -sign) + sign;
450 coeff2 *=
s->dequant_ac;
452 s->block_coeff[
b][
permute[idx]] = coeff2;
459 vlc_coeff = &
s->ract_vlc[
pt][ct][cg];
471 uint8_t *model1, *model2, *model3;
472 int coeff, sign, coeff_idx;
473 int b,
i, cg, idx,
ctx;
481 for (
b=0;
b<6;
b++) {
488 +
s->above_blocks[
s->above_block_idx[
b]].not_null_dc;
530 for (
run=9,
i=0;
i<6;
i++)
542 s->above_blocks[
s->above_block_idx[
b]].not_null_dc = !!
s->block_coeff[
b][0];
553 for (y=0; y<8; y+=2) {
554 for (
x=0;
x<8;
x+=2) {
564 int delta,
const int16_t *weights)
568 for (y=0; y<8; y++) {
569 for (
x=0;
x<8;
x++) {
570 dst[
x] = av_clip_uint8((
src[
x-
delta ] * weights[0]
571 +
src[
x ] * weights[1]
573 +
src[
x+2*
delta] * weights[3] + 64) >> 7);
581 ptrdiff_t
stride,
int h_weight,
int v_weight)
584 s->h264chroma.put_h264_chroma_pixels_tab[0](
tmp,
src,
stride, 9, h_weight, 0);
585 s->h264chroma.put_h264_chroma_pixels_tab[0](dst,
tmp,
stride, 8, 0, v_weight);
589 int offset1,
int offset2, ptrdiff_t
stride,
599 filter4 =
s->filter_mode;
601 if (
s->max_vector_length &&
602 (
FFABS(
mv.x) >
s->max_vector_length ||
603 FFABS(
mv.y) >
s->max_vector_length)) {
605 }
else if (
s->sample_variance_threshold
607 <
s->sample_variance_threshold)) {
613 if ((y8 && (offset2-offset1)*
s->flip<0) || (!y8 && offset1 > offset2)) {
625 s->vp56dsp.vp6_filter_diag4(dst,
src+offset1+((
mv.x^
mv.y)>>31),
stride,
631 s->h264chroma.put_h264_chroma_pixels_tab[0](dst,
src + offset1,
stride, 8, x8, y8);
653 s->alpha_context =
av_mallocz(
sizeof(VP56Context));
655 s->flip == -1,
s->has_alpha);
665 s->deblock_filtering = 0;
684 if (
s->alpha_context) {
700 for (ct=0; ct<3; ct++)
701 for (cg=0; cg<6; cg++)
711 .priv_data_size =
sizeof(VP56Context),
724 .priv_data_size =
sizeof(VP56Context),
737 .priv_data_size =
sizeof(VP56Context),
static av_always_inline int vp56_rac_get(VP56RangeCoder *c)
av_cold int ff_vp56_init(AVCodecContext *avctx, int flip, int has_alpha)
static const uint8_t vp6_def_fdv_vector_model[2][8]
static const int16_t vp6_block_copy_filter[17][8][4]
static av_cold int init(AVCodecContext *avctx)
static int get_bits_left(GetBitContext *gb)
static av_cold int vp6_decode_free(AVCodecContext *avctx)
static av_always_inline int vpX_rac_is_end(VP56RangeCoder *c)
vp5689 returns 1 if the end of the stream has been reached, 0 otherwise.
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
uint8_t mb_types_stats[3][10][2]
static void vp6_coeff_order_table_init(VP56Context *s)
const uint8_t ff_vp56_coeff_bit_length[]
static const int8_t mv[256][2]
av_cold int ff_vp56_init_context(AVCodecContext *avctx, VP56Context *s, int flip, int has_alpha)
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static void vp6_filter_diag2(VP56Context *s, uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h_weight, int v_weight)
uint8_t coeff_index_to_pos[64]
uint8_t coeff_ract[2][3][6][11]
static av_unused int vp56_rac_gets_nn(VP56RangeCoder *c, int bits)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static const uint8_t vp6_def_coeff_reorder[]
static av_always_inline int vp56_rac_get_prob_branchy(VP56RangeCoder *c, int prob)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
const struct AVCodec * codec
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
static double val(void *priv, double ch)
const uint8_t ff_vp56_b6to4[]
static float square_sum(const float *x, const float *y, int size)
static int vp6_huff_cmp(const void *va, const void *vb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint16_t mask[17]
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
static const uint8_t vp6_huff_coeff_map[]
static const uint8_t vp6_huff_run_map[]
static void permute(uint8_t *dst, const uint8_t *src, const uint8_t permutation[64])
static const uint8_t vp6_dccv_pct[2][11]
static const uint8_t vp6_def_runv_coeff_model[2][14]
static int vp56_rac_gets(VP56RangeCoder *c, int bits)
av_cold int ff_vp56_free_context(VP56Context *s)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void ff_free_vlc(VLC *vlc)
uint8_t coeff_dccv[2][11]
uint8_t coeff_dcct[2][36][5]
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static const VP56Tree vp6_pcr_tree[]
static av_cold void vp6_decode_init_context(VP56Context *s)
static unsigned vp6_get_nb_null(VP56Context *s)
Read number of consecutive blocks with null DC or AC.
uint8_t coeff_runv[2][14]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
const uint8_t ff_vp56_def_mb_types_stats[3][10][2]
static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size)
static unsigned int get_bits1(GetBitContext *s)
void ff_vp6dsp_init(VP56DSPContext *s)
static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
static const uint8_t vp6_sig_dct_pct[2][2]
static const uint8_t vp6_fdv_pct[2][8]
static const uint8_t vp6_coord_div[]
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static void vp6_filter_hv4(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int delta, const int16_t *weights)
#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.
static void vp6_default_models_init(VP56Context *s)
const uint8_t ff_vp56_coeff_parse_table[6][11]
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int vp6_parse_coeff_models(VP56Context *s)
static av_always_inline int vp56_rac_get_tree(VP56RangeCoder *c, const VP56Tree *tree, const uint8_t *probs)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
#define VP6_MAX_HUFF_SIZE
#define AV_CODEC_CAP_SLICE_THREADS
Codec supports slice-based (or partition-based) multithreading.
const VP56Tree ff_vp56_pva_tree[]
int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
uint8_t coeff_index_to_idct_selector[64]
#define i(width, name, range_min, range_max)
static av_cold int vp6_decode_init(AVCodecContext *avctx)
const VP56Tree ff_vp56_pc_tree[]
const char * name
Name of the codec implementation.
static void vp6_filter(VP56Context *s, uint8_t *dst, uint8_t *src, int offset1, int offset2, ptrdiff_t stride, VP56mv mv, int mask, int select, int luma)
const uint8_t ff_vp56_coeff_bias[]
main external API structure.
static int vp6_block_variance(uint8_t *src, ptrdiff_t stride)
static const uint8_t vp6_coeff_reorder_pct[]
static void vp6_parse_vector_models(VP56Context *s)
void ff_vp56_init_dequant(VP56Context *s, int quantizer)
static const int vp6_dccv_lc[3][5][2]
static const uint8_t vp6_pdv_pct[2][7]
int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
av_cold int ff_vp56_free(AVCodecContext *avctx)
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
#define vp56_rac_get_prob
static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[], const uint8_t *map, unsigned size, VLC *vlc)
const VDPAUPixFmtMap * map
static const uint8_t vp6_coeff_groups[]
static const uint8_t vp6_def_pdv_vector_model[2][7]
static const double coeff[2][5]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int vp6_parse_coeff_huffman(VP56Context *s)
int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes, int nb_bits, Node *nodes, HuffCmp cmp, int flags)
nodes size must be 2*nb_codes first nb_codes nodes.count must be set
static av_cold void vp6_decode_free_context(VP56Context *s)
static int vp6_parse_coeff(VP56Context *s)
VLC_TYPE(* table)[2]
code, bits
#define FF_HUFFMAN_FLAG_HNODE_FIRST
static const uint8_t vp6_runv_pct[2][14]
static const uint8_t vp6_ract_pct[3][2][6][11]
uint8_t coeff_reorder[64]