Go to the documentation of this file.
28 #define POS(x, y) src[(x) + stride * (y)]
31 int log2_size,
int c_idx)
34 ((x) >> s->ps.sps->log2_min_pu_size)
36 (s->ref->tab_mvf[(x) + (y) * min_pu_width])
37 #define MVF_PU(x, y) \
38 MVF(PU(x0 + ((x) * (1 << hshift))), PU(y0 + ((y) * (1 << vshift))))
39 #define IS_INTRA(x, y) \
40 (MVF_PU(x, y).pred_flag == PF_INTRA)
41 #define MIN_TB_ADDR_ZS(x, y) \
42 s->ps.pps->min_tb_addr_zs[(y) * (s->ps.sps->tb_mask+2) + (x)]
43 #define EXTEND(ptr, val, len) \
45 pixel4 pix = PIXEL_SPLAT_X4(val); \
46 for (i = 0; i < (len); i += 4) \
47 AV_WN4P(ptr + i, pix); \
50 #define EXTEND_RIGHT_CIP(ptr, start, length) \
51 for (i = start; i < (start) + (length); i += 4) \
52 if (!IS_INTRA(i, -1)) \
53 AV_WN4P(&ptr[i], a); \
55 a = PIXEL_SPLAT_X4(ptr[i+3])
56 #define EXTEND_LEFT_CIP(ptr, start, length) \
57 for (i = start; i > (start) - (length); i--) \
58 if (!IS_INTRA(i - 1, -1)) \
60 #define EXTEND_UP_CIP(ptr, start, length) \
61 for (i = (start); i > (start) - (length); i -= 4) \
62 if (!IS_INTRA(-1, i - 3)) \
63 AV_WN4P(&ptr[i - 3], a); \
65 a = PIXEL_SPLAT_X4(ptr[i - 3])
66 #define EXTEND_DOWN_CIP(ptr, start, length) \
67 for (i = start; i < (start) + (length); i += 4) \
68 if (!IS_INTRA(-1, i)) \
69 AV_WN4P(&ptr[i], a); \
71 a = PIXEL_SPLAT_X4(ptr[i + 3])
75 int hshift =
s->ps.sps->hshift[c_idx];
76 int vshift =
s->ps.sps->vshift[c_idx];
77 int size = (1 << log2_size);
78 int size_in_luma_h =
size << hshift;
79 int size_in_tbs_h = size_in_luma_h >>
s->ps.sps->log2_min_tb_size;
80 int size_in_luma_v =
size << vshift;
81 int size_in_tbs_v = size_in_luma_v >>
s->ps.sps->log2_min_tb_size;
84 int x_tb = (x0 >>
s->ps.sps->log2_min_tb_size) &
s->ps.sps->tb_mask;
85 int y_tb = (y0 >>
s->ps.sps->log2_min_tb_size) &
s->ps.sps->tb_mask;
89 ptrdiff_t
stride =
s->frame->linesize[c_idx] /
sizeof(
pixel);
92 int min_pu_width =
s->ps.sps->min_pu_width;
103 pixel *top = top_array + 1;
104 pixel *filtered_left = filtered_left_array + 1;
105 pixel *filtered_top = filtered_top_array + 1;
112 int bottom_left_size = (
FFMIN(y0 + 2 * size_in_luma_v,
s->ps.sps->height) -
113 (y0 + size_in_luma_v)) >> vshift;
114 int top_right_size = (
FFMIN(x0 + 2 * size_in_luma_h,
s->ps.sps->width) -
115 (x0 + size_in_luma_h)) >> hshift;
117 if (
s->ps.pps->constrained_intra_pred_flag == 1) {
118 int size_in_luma_pu_v =
PU(size_in_luma_v);
119 int size_in_luma_pu_h =
PU(size_in_luma_h);
120 int on_pu_edge_x = !av_mod_uintp2(x0,
s->ps.sps->log2_min_pu_size);
121 int on_pu_edge_y = !av_mod_uintp2(y0,
s->ps.sps->log2_min_pu_size);
122 if (!size_in_luma_pu_h)
124 if (cand_bottom_left == 1 && on_pu_edge_x) {
125 int x_left_pu =
PU(x0 - 1);
126 int y_bottom_pu =
PU(y0 + size_in_luma_v);
127 int max =
FFMIN(size_in_luma_pu_v,
s->ps.sps->min_pu_height - y_bottom_pu);
128 cand_bottom_left = 0;
129 for (
i = 0;
i <
max;
i += 2)
130 cand_bottom_left |= (
MVF(x_left_pu, y_bottom_pu +
i).pred_flag ==
PF_INTRA);
132 if (cand_left == 1 && on_pu_edge_x) {
133 int x_left_pu =
PU(x0 - 1);
134 int y_left_pu =
PU(y0);
135 int max =
FFMIN(size_in_luma_pu_v,
s->ps.sps->min_pu_height - y_left_pu);
137 for (
i = 0;
i <
max;
i += 2)
138 cand_left |= (
MVF(x_left_pu, y_left_pu +
i).pred_flag ==
PF_INTRA);
140 if (cand_up_left == 1) {
141 int x_left_pu =
PU(x0 - 1);
142 int y_top_pu =
PU(y0 - 1);
143 cand_up_left =
MVF(x_left_pu, y_top_pu).pred_flag ==
PF_INTRA;
145 if (cand_up == 1 && on_pu_edge_y) {
146 int x_top_pu =
PU(x0);
147 int y_top_pu =
PU(y0 - 1);
148 int max =
FFMIN(size_in_luma_pu_h,
s->ps.sps->min_pu_width - x_top_pu);
150 for (
i = 0;
i <
max;
i += 2)
151 cand_up |= (
MVF(x_top_pu +
i, y_top_pu).pred_flag ==
PF_INTRA);
153 if (cand_up_right == 1 && on_pu_edge_y) {
154 int y_top_pu =
PU(y0 - 1);
155 int x_right_pu =
PU(x0 + size_in_luma_h);
156 int max =
FFMIN(size_in_luma_pu_h,
s->ps.sps->min_pu_width - x_right_pu);
158 for (
i = 0;
i <
max;
i += 2)
159 cand_up_right |= (
MVF(x_right_pu +
i, y_top_pu).pred_flag ==
PF_INTRA);
174 size - top_right_size);
179 if (cand_bottom_left) {
183 size - bottom_left_size);
186 if (
s->ps.pps->constrained_intra_pred_flag == 1) {
187 if (cand_bottom_left || cand_left || cand_up_left || cand_up || cand_up_right) {
188 int size_max_x = x0 + ((2 *
size) << hshift) <
s->ps.sps->width ?
189 2 *
size : (
s->ps.sps->width - x0) >> hshift;
190 int size_max_y = y0 + ((2 *
size) << vshift) <
s->ps.sps->height ?
191 2 *
size : (
s->ps.sps->height - y0) >> vshift;
192 int j =
size + (cand_bottom_left? bottom_left_size: 0) -1;
193 if (!cand_up_right) {
194 size_max_x = x0 + ((
size) << hshift) <
s->ps.sps->width ?
195 size : (
s->ps.sps->width - x0) >> hshift;
197 if (!cand_bottom_left) {
198 size_max_y = y0 + ((
size) << vshift) <
s->ps.sps->height ?
199 size : (
s->ps.sps->height - y0) >> vshift;
201 if (cand_bottom_left || cand_left || cand_up_left) {
206 while (j < size_max_x && !
IS_INTRA(j, -1))
213 while (j < size_max_x && !
IS_INTRA(j, -1))
225 if (cand_bottom_left || cand_left) {
231 if (!cand_bottom_left)
233 if (x0 != 0 && y0 != 0) {
238 }
else if (x0 == 0) {
252 if (!cand_bottom_left) {
255 }
else if (cand_up_left) {
258 }
else if (cand_up) {
263 }
else if (cand_up_right) {
290 if (!
s->ps.sps->intra_smoothing_disabled_flag && (c_idx == 0 ||
s->ps.sps->chroma_format_idc == 3)) {
292 int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
295 if (min_dist_vert_hor > intra_hor_ver_dist_thresh[log2_size - 3]) {
297 if (
s->ps.sps->sps_strong_intra_smoothing_enable_flag && c_idx == 0 &&
299 FFABS(top[-1] + top[63] - 2 * top[31]) < threshold &&
303 filtered_top[-1] = top[-1];
304 filtered_top[63] = top[63];
305 for (
i = 0;
i < 63;
i++)
306 filtered_top[
i] = ((64 - (
i + 1)) * top[-1] +
307 (
i + 1) * top[63] + 32) >> 6;
308 for (
i = 0;
i < 63;
i++)
310 (
i + 1) *
left[63] + 32) >> 6;
314 filtered_top[2 *
size - 1] = top[2 *
size - 1];
315 for (
i = 2 *
size - 2;
i >= 0;
i--)
317 left[
i - 1] + 2) >> 2;
319 filtered_left[-1] = (
left[0] + 2 *
left[-1] + top[0] + 2) >> 2;
320 for (
i = 2 *
size - 2;
i >= 0;
i--)
321 filtered_top[
i] = (top[
i + 1] + 2 * top[
i] +
322 top[
i - 1] + 2) >> 2;
323 left = filtered_left;
347 #define INTRA_PRED(size) \
348 static void FUNC(intra_pred_ ## size)(HEVCContext *s, int x0, int y0, int c_idx) \
350 FUNC(intra_pred)(s, x0, y0, size, c_idx); \
368 int size = 1 << trafo_size;
369 for (y = 0; y <
size; y++)
375 #define PRED_PLANAR(size)\
376 static void FUNC(pred_planar_ ## size)(uint8_t *src, const uint8_t *top, \
377 const uint8_t *left, ptrdiff_t stride) \
379 FUNC(pred_planar)(src, top, left, stride, size + 2); \
391 ptrdiff_t
stride,
int log2_size,
int c_idx)
394 int size = (1 << log2_size);
403 dc >>= log2_size + 1;
408 for (j = 0; j <
size; j+=4)
411 if (c_idx == 0 &&
size < 32) {
412 POS(0, 0) = (
left[0] + 2 *
dc + top[0] + 2) >> 2;
414 POS(
x, 0) = (top[
x] + 3 *
dc + 2) >> 2;
415 for (y = 1; y <
size; y++)
423 ptrdiff_t
stride,
int c_idx,
431 static const int intra_pred_angle[] = {
432 32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26, -32,
433 -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32
435 static const int inv_angle[] = {
436 -4096, -1638, -910, -630, -482, -390, -315, -256, -315, -390, -482,
437 -630, -910, -1638, -4096
440 int angle = intra_pred_angle[
mode - 2];
444 int last = (
size * angle) >> 5;
448 if (angle < 0 && last < -1) {
451 for (
x = last;
x <= -1;
x++)
452 ref_tmp[
x] =
left[-1 + ((
x * inv_angle[
mode - 11] + 128) >> 8)];
456 for (y = 0; y <
size; y++) {
457 int idx = ((y + 1) * angle) >> 5;
458 int fact = ((y + 1) * angle) & 31;
460 for (
x = 0;
x <
size;
x += 4) {
461 POS(
x , y) = ((32 - fact) *
ref[
x + idx + 1] +
462 fact *
ref[
x + idx + 2] + 16) >> 5;
463 POS(
x + 1, y) = ((32 - fact) *
ref[
x + 1 + idx + 1] +
464 fact *
ref[
x + 1 + idx + 2] + 16) >> 5;
465 POS(
x + 2, y) = ((32 - fact) *
ref[
x + 2 + idx + 1] +
466 fact *
ref[
x + 2 + idx + 2] + 16) >> 5;
467 POS(
x + 3, y) = ((32 - fact) *
ref[
x + 3 + idx + 1] +
468 fact *
ref[
x + 3 + idx + 2] + 16) >> 5;
475 if (
mode == 26 && c_idx == 0 &&
size < 32) {
476 for (y = 0; y <
size; y++)
481 if (angle < 0 && last < -1) {
484 for (
x = last;
x <= -1;
x++)
485 ref_tmp[
x] = top[-1 + ((
x * inv_angle[
mode - 11] + 128) >> 8)];
490 int idx = ((
x + 1) * angle) >> 5;
491 int fact = ((
x + 1) * angle) & 31;
493 for (y = 0; y <
size; y++) {
494 POS(
x, y) = ((32 - fact) *
ref[y + idx + 1] +
495 fact *
ref[y + idx + 2] + 16) >> 5;
498 for (y = 0; y <
size; y++)
502 if (
mode == 10 && c_idx == 0 &&
size < 32) {
503 for (
x = 0;
x <
size;
x += 4) {
541 #undef EXTEND_LEFT_CIP
542 #undef EXTEND_RIGHT_CIP
544 #undef EXTEND_DOWN_CIP
550 #undef MIN_TB_ADDR_ZS
static av_always_inline void FUNC() intra_pred(HEVCContext *s, int x0, int y0, int log2_size, int c_idx)
#define EXTEND_UP_CIP(ptr, start, length)
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 av_always_inline void FUNC() pred_angular(uint8_t *_src, const uint8_t *_top, const uint8_t *_left, ptrdiff_t stride, int c_idx, int mode, int size)
#define EXTEND_LEFT_CIP(ptr, start, length)
static av_always_inline void FUNC() pred_planar(uint8_t *_src, const uint8_t *_top, const uint8_t *_left, ptrdiff_t stride, int trafo_size)
#define PIXEL_SPLAT_X4(x)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static void FUNC() pred_angular_1(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int c_idx, int mode)
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff) *mv_scale Intra DC Prediction block[y][x] dc[1]
static void FUNC() pred_angular_0(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int c_idx, int mode)
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 i(width, name, range_min, range_max)
#define MIN_TB_ADDR_ZS(x, y)
#define EXTEND_RIGHT_CIP(ptr, start, length)
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
static void FUNC() pred_angular_3(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int c_idx, int mode)
static int ref[MAX_W *MAX_W]
#define PRED_PLANAR(size)
#define EXTEND(ptr, val, len)
static void FUNC() pred_angular_2(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int c_idx, int mode)
static void FUNC() pred_dc(uint8_t *_src, const uint8_t *_top, const uint8_t *_left, ptrdiff_t stride, int log2_size, int c_idx)
#define EXTEND_DOWN_CIP(ptr, start, length)