Go to the documentation of this file.
152 #define FULLPEL_MODE 1
153 #define HALFPEL_MODE 2
154 #define THIRDPEL_MODE 3
155 #define PREDICT_MODE 4
167 0 + 0 * 4, 1 + 0 * 4, 2 + 0 * 4, 2 + 1 * 4,
168 2 + 2 * 4, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4,
169 0 + 1 * 4, 0 + 2 * 4, 1 + 1 * 4, 1 + 2 * 4,
170 0 + 3 * 4, 1 + 3 * 4, 2 + 3 * 4, 3 + 3 * 4,
174 0 * 16 + 0 * 64, 1 * 16 + 0 * 64, 2 * 16 + 0 * 64, 0 * 16 + 2 * 64,
175 3 * 16 + 0 * 64, 0 * 16 + 1 * 64, 1 * 16 + 1 * 64, 2 * 16 + 1 * 64,
176 1 * 16 + 2 * 64, 2 * 16 + 2 * 64, 3 * 16 + 2 * 64, 0 * 16 + 3 * 64,
177 3 * 16 + 1 * 64, 1 * 16 + 3 * 64, 2 * 16 + 3 * 64, 3 * 16 + 3 * 64,
183 { 0, 2 }, { 1, 1 }, { 2, 0 },
184 { 3, 0 }, { 2, 1 }, { 1, 2 }, { 0, 3 },
185 { 0, 4 }, { 1, 3 }, { 2, 2 }, { 3, 1 }, { 4, 0 },
186 { 4, 1 }, { 3, 2 }, { 2, 3 }, { 1, 4 },
187 { 2, 4 }, { 3, 3 }, { 4, 2 },
193 { { 2, -1, -1, -1, -1 }, { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 },
194 { 2, 1, -1, -1, -1 }, { 1, 2, -1, -1, -1 }, { 1, 2, -1, -1, -1 } },
195 { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 4, 3 }, { 0, 1, 2, 4, 3 },
196 { 0, 2, 1, 4, 3 }, { 2, 0, 1, 3, 4 }, { 0, 4, 2, 1, 3 } },
197 { { 2, 0, -1, -1, -1 }, { 2, 1, 0, 4, 3 }, { 1, 2, 4, 0, 3 },
198 { 2, 1, 0, 4, 3 }, { 2, 1, 4, 3, 0 }, { 1, 2, 4, 0, 3 } },
199 { { 2, 0, -1, -1, -1 }, { 2, 0, 1, 4, 3 }, { 1, 2, 0, 4, 3 },
200 { 2, 1, 0, 4, 3 }, { 2, 1, 3, 4, 0 }, { 2, 4, 1, 0, 3 } },
201 { { 0, 2, -1, -1, -1 }, { 0, 2, 1, 3, 4 }, { 1, 2, 3, 0, 4 },
202 { 2, 0, 1, 3, 4 }, { 2, 1, 3, 0, 4 }, { 2, 0, 4, 3, 1 } },
203 { { 0, 2, -1, -1, -1 }, { 0, 2, 4, 1, 3 }, { 1, 4, 2, 0, 3 },
204 { 4, 2, 0, 1, 3 }, { 2, 0, 1, 4, 3 }, { 4, 2, 1, 0, 3 } },
207 static const struct {
211 { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 2, 1 }, { 0, 2 }, { 3, 1 }, { 4, 1 }, { 5, 1 },
212 { 0, 3 }, { 1, 2 }, { 2, 2 }, { 6, 1 }, { 7, 1 }, { 8, 1 }, { 9, 1 }, { 0, 4 } },
213 { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 0, 2 }, { 2, 1 }, { 0, 3 }, { 0, 4 }, { 0, 5 },
214 { 3, 1 }, { 4, 1 }, { 1, 2 }, { 1, 3 }, { 0, 6 }, { 0, 7 }, { 0, 8 }, { 0, 9 } }
218 3881, 4351, 4890, 5481, 6154, 6914, 7761, 8718,
219 9781, 10987, 12339, 13828, 15523, 17435, 19561, 21873,
220 24552, 27656, 30847, 34870, 38807, 43747, 49103, 54683,
221 61694, 68745, 77615, 89113, 100253, 109366, 126635, 141533
234 for (
i = 0;
i < 4;
i++) {
235 const int z0 = 13 * (
input[4 *
i + 0] +
input[4 *
i + 2]);
236 const int z1 = 13 * (
input[4 *
i + 0] -
input[4 *
i + 2]);
237 const int z2 = 7 *
input[4 *
i + 1] - 17 *
input[4 *
i + 3];
238 const int z3 = 17 *
input[4 *
i + 1] + 7 *
input[4 *
i + 3];
240 temp[4 *
i + 0] = z0 + z3;
241 temp[4 *
i + 1] = z1 + z2;
242 temp[4 *
i + 2] = z1 - z2;
243 temp[4 *
i + 3] = z0 - z3;
246 for (
i = 0;
i < 4;
i++) {
247 const int offset = x_offset[
i];
248 const int z0 = 13 * (
temp[4 * 0 +
i] +
temp[4 * 2 +
i]);
249 const int z1 = 13 * (
temp[4 * 0 +
i] -
temp[4 * 2 +
i]);
250 const int z2 = 7 *
temp[4 * 1 +
i] - 17 *
temp[4 * 3 +
i];
251 const int z3 = 17 *
temp[4 * 1 +
i] + 7 *
temp[4 * 3 +
i];
269 : qmul * (
block[0] >> 3) / 2);
273 for (
i = 0;
i < 4;
i++) {
274 const int z0 = 13 * (
block[0 + 4 *
i] +
block[2 + 4 *
i]);
275 const int z1 = 13 * (
block[0 + 4 *
i] -
block[2 + 4 *
i]);
276 const int z2 = 7 *
block[1 + 4 *
i] - 17 *
block[3 + 4 *
i];
277 const int z3 = 17 *
block[1 + 4 *
i] + 7 *
block[3 + 4 *
i];
279 block[0 + 4 *
i] = z0 + z3;
280 block[1 + 4 *
i] = z1 + z2;
281 block[2 + 4 *
i] = z1 - z2;
282 block[3 + 4 *
i] = z0 - z3;
285 for (
i = 0;
i < 4;
i++) {
286 const unsigned z0 = 13 * (
block[
i + 4 * 0] +
block[
i + 4 * 2]);
287 const unsigned z1 = 13 * (
block[
i + 4 * 0] -
block[
i + 4 * 2]);
288 const unsigned z2 = 7 *
block[
i + 4 * 1] - 17 *
block[
i + 4 * 3];
289 const unsigned z3 = 17 *
block[
i + 4 * 1] + 7 *
block[
i + 4 * 3];
290 const int rr = (
dc + 0x80000
u);
292 dst[
i +
stride * 0] = av_clip_uint8(dst[
i +
stride * 0] + ((
int)((z0 + z3) * qmul + rr) >> 20));
293 dst[
i +
stride * 1] = av_clip_uint8(dst[
i +
stride * 1] + ((
int)((z1 + z2) * qmul + rr) >> 20));
294 dst[
i +
stride * 2] = av_clip_uint8(dst[
i +
stride * 2] + ((
int)((z1 - z2) * qmul + rr) >> 20));
295 dst[
i +
stride * 3] = av_clip_uint8(dst[
i +
stride * 3] + ((
int)((z0 - z3) * qmul + rr) >> 20));
298 memset(
block, 0, 16 *
sizeof(int16_t));
304 static const uint8_t *
const scan_patterns[4] = {
310 const int intra = 3 *
type >> 2;
313 for (limit = (16 >> intra);
index < 16;
index = limit, limit += 8) {
318 sign = (vlc & 1) ? 0 : -1;
325 }
else if (vlc < 4) {
338 level = (vlc >> 3) + ((
run == 0) ? 8 : ((
run < 2) ? 2 : ((
run < 5) ? 0 : -1)));
341 level = (vlc >> 4) + ((
run == 0) ? 4 : ((
run < 3) ? 2 : ((
run < 10) ? 1 : 0)));
362 int i,
int list,
int part_width)
364 const int topright_ref =
s->ref_cache[
list][
i - 8 + part_width];
367 *
C =
s->mv_cache[
list][
i - 8 + part_width];
370 *
C =
s->mv_cache[
list][
i - 8 - 1];
371 return s->ref_cache[
list][
i - 8 - 1];
383 int part_width,
int list,
384 int ref,
int *
const mx,
int *
const my)
386 const int index8 =
scan8[n];
387 const int top_ref =
s->ref_cache[
list][index8 - 8];
388 const int left_ref =
s->ref_cache[
list][index8 - 1];
389 const int16_t *
const A =
s->mv_cache[
list][index8 - 1];
390 const int16_t *
const B =
s->mv_cache[
list][index8 - 8];
392 int diagonal_ref, match_count;
403 match_count = (diagonal_ref ==
ref) + (top_ref ==
ref) + (left_ref ==
ref);
404 if (match_count > 1) {
407 }
else if (match_count == 1) {
408 if (left_ref ==
ref) {
411 }
else if (top_ref ==
ref) {
433 int mx,
int my,
int dxy,
434 int thirdpel,
int dir,
int avg)
436 const SVQ3Frame *pic = (dir == 0) ?
s->last_pic :
s->next_pic;
439 int blocksize = 2 - (
width >> 3);
440 int linesize =
s->cur_pic->f->linesize[0];
441 int uvlinesize =
s->cur_pic->f->linesize[1];
446 if (mx < 0 || mx >=
s->h_edge_pos -
width - 1 ||
447 my < 0 || my >=
s->v_edge_pos -
height - 1) {
449 mx = av_clip(mx, -16,
s->h_edge_pos -
width + 15);
450 my = av_clip(my, -16,
s->v_edge_pos -
height + 15);
454 dest =
s->cur_pic->f->data[0] +
x + y * linesize;
455 src = pic->
f->
data[0] + mx + my * linesize;
458 s->vdsp.emulated_edge_mc(
s->edge_emu_buffer,
src,
461 mx, my,
s->h_edge_pos,
s->v_edge_pos);
462 src =
s->edge_emu_buffer;
465 (
avg ?
s->tdsp.avg_tpel_pixels_tab
466 :
s->tdsp.put_tpel_pixels_tab)[dxy](dest,
src, linesize,
469 (
avg ?
s->hdsp.avg_pixels_tab
470 :
s->hdsp.put_pixels_tab)[blocksize][dxy](dest,
src, linesize,
474 mx = mx + (mx < (
int)
x) >> 1;
475 my = my + (my < (
int) y) >> 1;
480 for (
i = 1;
i < 3;
i++) {
481 dest =
s->cur_pic->f->data[
i] + (
x >> 1) + (y >> 1) * uvlinesize;
482 src = pic->
f->
data[
i] + mx + my * uvlinesize;
485 s->vdsp.emulated_edge_mc(
s->edge_emu_buffer,
src,
486 uvlinesize, uvlinesize,
488 mx, my, (
s->h_edge_pos >> 1),
490 src =
s->edge_emu_buffer;
493 (
avg ?
s->tdsp.avg_tpel_pixels_tab
494 :
s->tdsp.put_tpel_pixels_tab)[dxy](dest,
src,
498 (
avg ?
s->hdsp.avg_pixels_tab
499 :
s->hdsp.put_pixels_tab)[blocksize][dxy](dest,
src,
509 int i, j, k, mx, my, dx, dy,
x, y;
510 const int part_width = ((
size & 5) == 4) ? 4 : 16 >> (
size & 1);
511 const int part_height = 16 >> ((unsigned)(
size + 1) / 3);
513 const int h_edge_pos = 6 * (
s->h_edge_pos - part_width) - extra_width;
514 const int v_edge_pos = 6 * (
s->v_edge_pos - part_height) - extra_width;
516 for (
i = 0;
i < 16;
i += part_height)
517 for (j = 0; j < 16; j += part_width) {
518 const int b_xy = (4 *
s->mb_x + (j >> 2)) +
519 (4 *
s->mb_y + (
i >> 2)) *
s->b_stride;
521 x = 16 *
s->mb_x + j;
522 y = 16 *
s->mb_y +
i;
523 k = (j >> 2 & 1) + (
i >> 1 & 2) +
524 (j >> 1 & 4) + (
i & 8);
529 mx =
s->next_pic->motion_val[0][b_xy][0] * 2;
530 my =
s->next_pic->motion_val[0][b_xy][1] * 2;
533 mx = mx *
s->frame_num_offset /
534 s->prev_frame_num_offset + 1 >> 1;
535 my = my *
s->frame_num_offset /
536 s->prev_frame_num_offset + 1 >> 1;
538 mx = mx * (
s->frame_num_offset -
s->prev_frame_num_offset) /
539 s->prev_frame_num_offset + 1 >> 1;
540 my = my * (
s->frame_num_offset -
s->prev_frame_num_offset) /
541 s->prev_frame_num_offset + 1 >> 1;
546 mx = av_clip(mx, extra_width - 6 *
x, h_edge_pos - 6 *
x);
547 my = av_clip(my, extra_width - 6 * y, v_edge_pos - 6 * y);
556 if (dx != (int16_t)dx || dy != (int16_t)dy) {
565 mx = (mx + 1 >> 1) + dx;
566 my = (my + 1 >> 1) + dy;
567 fx = (unsigned)(mx + 0x30000) / 3 - 0x10000;
568 fy = (unsigned)(my + 0x30000) / 3 - 0x10000;
569 dxy = (mx - 3 * fx) + 4 * (my - 3 * fy);
572 fx, fy, dxy, 1, dir,
avg);
576 mx = (unsigned)(mx + 1 + 0x30000) / 3 + dx - 0x10000;
577 my = (unsigned)(my + 1 + 0x30000) / 3 + dy - 0x10000;
578 dxy = (mx & 1) + 2 * (my & 1);
581 mx >> 1, my >> 1, dxy, 0, dir,
avg);
585 mx = (unsigned)(mx + 3 + 0x60000) / 6 + dx - 0x10000;
586 my = (unsigned)(my + 3 + 0x60000) / 6 + dy - 0x10000;
589 mx, my, 0, 0, dir,
avg);
598 if (part_height == 8 &&
i < 8) {
601 if (part_width == 8 && j < 8)
604 if (part_width == 8 && j < 8)
606 if (part_width == 4 || part_height == 4)
612 part_width >> 2, part_height >> 2,
s->b_stride,
620 int mb_type,
const int *block_offset,
625 for (
i = 0;
i < 16;
i++)
626 if (
s->non_zero_count_cache[
scan8[
i]] ||
s->mb[
i * 16]) {
627 uint8_t *
const ptr = dest_y + block_offset[
i];
636 const int *block_offset,
641 int qscale =
s->qscale;
644 for (
i = 0;
i < 16;
i++) {
645 uint8_t *
const ptr = dest_y + block_offset[
i];
646 const int dir =
s->intra4x4_pred_mode_cache[
scan8[
i]];
651 const int topright_avail = (
s->topright_samples_available <<
i) & 0x8000;
653 if (!topright_avail) {
654 tr = ptr[3 - linesize] * 0x01010101
u;
657 topright = ptr + 4 - linesize;
661 s->hpc.pred4x4[dir](ptr, topright, linesize);
662 nnz =
s->non_zero_count_cache[
scan8[
i]];
668 s->hpc.pred16x16[
s->intra16x16_pred_mode](dest_y, linesize);
675 const int mb_x =
s->mb_x;
676 const int mb_y =
s->mb_y;
677 const int mb_xy =
s->mb_xy;
678 const int mb_type =
s->cur_pic->mb_type[mb_xy];
679 uint8_t *dest_y, *dest_cb, *dest_cr;
680 int linesize, uvlinesize;
682 const int *block_offset = &
s->block_offset[0];
683 const int block_h = 16 >> 1;
685 linesize =
s->cur_pic->f->linesize[0];
686 uvlinesize =
s->cur_pic->f->linesize[1];
688 dest_y =
s->cur_pic->f->data[0] + (mb_x + mb_y * linesize) * 16;
689 dest_cb =
s->cur_pic->f->data[1] + mb_x * 8 + mb_y * uvlinesize * block_h;
690 dest_cr =
s->cur_pic->f->data[2] + mb_x * 8 + mb_y * uvlinesize * block_h;
692 s->vdsp.prefetch(dest_y + (
s->mb_x & 3) * 4 * linesize + 64, linesize, 4);
693 s->vdsp.prefetch(dest_cb + (
s->mb_x & 7) * uvlinesize + 64, dest_cr - dest_cb, 2);
696 s->hpc.pred8x8[
s->chroma_pred_mode](dest_cb, uvlinesize);
697 s->hpc.pred8x8[
s->chroma_pred_mode](dest_cr, uvlinesize);
705 uint8_t *dest[2] = { dest_cb, dest_cr };
706 s->h264dsp.h264_chroma_dc_dequant_idct(
s->mb + 16 * 16 * 1,
707 s->dequant4_coeff[4][0]);
708 s->h264dsp.h264_chroma_dc_dequant_idct(
s->mb + 16 * 16 * 2,
709 s->dequant4_coeff[4][0]);
710 for (j = 1; j < 3; j++) {
711 for (
i = j * 16;
i < j * 16 + 4;
i++)
712 if (
s->non_zero_count_cache[
scan8[
i]] ||
s->mb[
i * 16]) {
713 uint8_t *
const ptr = dest[j - 1] + block_offset[
i];
723 int i, j, k, m, dir,
mode;
727 const int mb_xy =
s->mb_xy;
728 const int b_xy = 4 *
s->mb_x + 4 *
s->mb_y *
s->b_stride;
730 s->top_samples_available = (
s->mb_y == 0) ? 0x33FF : 0xFFFF;
731 s->left_samples_available = (
s->mb_x == 0) ? 0x5F5F : 0xFFFF;
732 s->topright_samples_available = 0xFFFF;
736 s->next_pic->mb_type[mb_xy] == -1) {
746 mb_type =
FFMIN(
s->next_pic->mb_type[mb_xy], 6);
754 }
else if (mb_type < 8) {
755 if (
s->thirdpel_flag &&
s->halfpel_flag == !
get_bits1(&
s->gb_slice))
757 else if (
s->halfpel_flag &&
772 for (m = 0; m < 2; m++) {
773 if (
s->mb_x > 0 &&
s->intra4x4_pred_mode[
s->mb2br_xy[mb_xy - 1] + 6] != -1) {
774 for (
i = 0;
i < 4;
i++)
776 s->cur_pic->motion_val[m][b_xy - 1 +
i *
s->b_stride]);
778 for (
i = 0;
i < 4;
i++)
782 memcpy(
s->mv_cache[m][
scan8[0] - 1 * 8],
783 s->cur_pic->motion_val[m][b_xy -
s->b_stride],
784 4 * 2 *
sizeof(int16_t));
785 memset(&
s->ref_cache[m][
scan8[0] - 1 * 8],
788 if (
s->mb_x <
s->mb_width - 1) {
790 s->cur_pic->motion_val[m][b_xy -
s->b_stride + 4]);
791 s->ref_cache[m][
scan8[0] + 4 - 1 * 8] =
792 (
s->intra4x4_pred_mode[
s->mb2br_xy[mb_xy -
s->mb_stride + 1] + 6] == -1 ||
798 s->cur_pic->motion_val[m][b_xy -
s->b_stride - 1]);
799 s->ref_cache[m][
scan8[0] - 1 - 1 * 8] =
804 memset(&
s->ref_cache[m][
scan8[0] - 1 * 8 - 1],
820 for (
i = 0;
i < 4;
i++)
821 memset(
s->cur_pic->motion_val[0][b_xy +
i *
s->b_stride],
822 0, 4 * 2 *
sizeof(int16_t));
828 for (
i = 0;
i < 4;
i++)
829 memset(
s->cur_pic->motion_val[1][b_xy +
i *
s->b_stride],
830 0, 4 * 2 *
sizeof(int16_t));
835 }
else if (mb_type == 8 || mb_type == 33) {
836 int8_t *i4x4 =
s->intra4x4_pred_mode +
s->mb2br_xy[
s->mb_xy];
837 int8_t *i4x4_cache =
s->intra4x4_pred_mode_cache;
839 memset(
s->intra4x4_pred_mode_cache, -1, 8 * 5 *
sizeof(int8_t));
843 for (
i = 0;
i < 4;
i++)
844 s->intra4x4_pred_mode_cache[
scan8[0] - 1 +
i * 8] =
s->intra4x4_pred_mode[
s->mb2br_xy[mb_xy - 1] + 6 -
i];
845 if (
s->intra4x4_pred_mode_cache[
scan8[0] - 1] == -1)
846 s->left_samples_available = 0x5F5F;
849 s->intra4x4_pred_mode_cache[4 + 8 * 0] =
s->intra4x4_pred_mode[
s->mb2br_xy[mb_xy -
s->mb_stride] + 0];
850 s->intra4x4_pred_mode_cache[5 + 8 * 0] =
s->intra4x4_pred_mode[
s->mb2br_xy[mb_xy -
s->mb_stride] + 1];
851 s->intra4x4_pred_mode_cache[6 + 8 * 0] =
s->intra4x4_pred_mode[
s->mb2br_xy[mb_xy -
s->mb_stride] + 2];
852 s->intra4x4_pred_mode_cache[7 + 8 * 0] =
s->intra4x4_pred_mode[
s->mb2br_xy[mb_xy -
s->mb_stride] + 3];
854 if (
s->intra4x4_pred_mode_cache[4 + 8 * 0] == -1)
855 s->top_samples_available = 0x33FF;
859 for (
i = 0;
i < 16;
i += 2) {
864 "luma prediction:%"PRIu32
"\n", vlc);
869 top = &
s->intra4x4_pred_mode_cache[
scan8[
i] - 8];
874 if (
left[1] == -1 ||
left[2] == -1) {
880 for (
i = 0;
i < 4;
i++)
881 memset(&
s->intra4x4_pred_mode_cache[
scan8[0] + 8 *
i],
DC_PRED, 4);
885 i4x4[4] = i4x4_cache[7 + 8 * 3];
886 i4x4[5] = i4x4_cache[7 + 8 * 2];
887 i4x4[6] = i4x4_cache[7 + 8 * 1];
891 s->avctx,
s->top_samples_available,
892 s->left_samples_available);
894 s->top_samples_available = (
s->mb_y == 0) ? 0x33FF : 0xFFFF;
895 s->left_samples_available = (
s->mb_x == 0) ? 0x5F5F : 0xFFFF;
897 for (
i = 0;
i < 4;
i++)
900 s->top_samples_available = 0x33FF;
901 s->left_samples_available = 0x5F5F;
907 dir = (dir >> 1) ^ 3 * (dir & 1) ^ 1;
910 s->left_samples_available, dir, 0)) < 0) {
912 return s->intra16x16_pred_mode;
920 for (
i = 0;
i < 4;
i++)
921 memset(
s->cur_pic->motion_val[0][b_xy +
i *
s->b_stride],
922 0, 4 * 2 *
sizeof(int16_t));
924 for (
i = 0;
i < 4;
i++)
925 memset(
s->cur_pic->motion_val[1][b_xy +
i *
s->b_stride],
926 0, 4 * 2 *
sizeof(int16_t));
930 memset(
s->intra4x4_pred_mode +
s->mb2br_xy[mb_xy],
DC_PRED, 8);
933 memset(
s->non_zero_count_cache + 8, 0, 14 * 8 *
sizeof(
uint8_t));
950 if (
s->qscale > 31
u) {
960 "error while decoding intra luma dc\n");
969 for (
i = 0;
i < 4;
i++)
970 if ((cbp & (1 <<
i))) {
971 for (j = 0; j < 4; j++) {
972 k =
index ? (1 * (j & 1) + 2 * (
i & 1) +
973 2 * (j & 2) + 4 * (
i & 2))
975 s->non_zero_count_cache[
scan8[k]] = 1;
979 "error while decoding block\n");
986 for (
i = 1;
i < 3; ++
i)
989 "error while decoding chroma dc block\n");
994 for (
i = 1;
i < 3;
i++) {
995 for (j = 0; j < 4; j++) {
997 s->non_zero_count_cache[
scan8[k]] = 1;
1001 "error while decoding chroma ac block\n");
1011 s->cur_pic->mb_type[mb_xy] = mb_type;
1023 const int mb_xy =
s->mb_xy;
1034 int slice_bits, slice_bytes, slice_length;
1035 int length =
header >> 5 & 3;
1037 slice_length =
show_bits(&
s->gb, 8 * length);
1038 slice_bits = slice_length * 8;
1039 slice_bytes = slice_length + length - 1;
1051 memcpy(
s->slice_buf,
s->gb.buffer +
s->gb.index / 8, slice_bytes);
1053 if (
s->watermark_key) {
1060 memmove(
s->slice_buf, &
s->slice_buf[slice_length], length - 1);
1072 if ((
header & 0x9F) == 2) {
1073 i = (
s->mb_num < 64) ? 6 : (1 +
av_log2(
s->mb_num - 1));
1087 if (
s->has_watermark)
1098 memset(
s->intra4x4_pred_mode +
s->mb2br_xy[mb_xy - 1] + 3,
1099 -1, 4 *
sizeof(int8_t));
1100 memset(
s->intra4x4_pred_mode +
s->mb2br_xy[mb_xy -
s->mb_x],
1101 -1, 8 *
sizeof(int8_t) *
s->mb_x);
1104 memset(
s->intra4x4_pred_mode +
s->mb2br_xy[mb_xy -
s->mb_stride],
1105 -1, 8 *
sizeof(int8_t) * (
s->mb_width -
s->mb_x));
1108 s->intra4x4_pred_mode[
s->mb2br_xy[mb_xy -
s->mb_stride - 1] + 3] = -1;
1117 const int max_qp = 51;
1119 for (q = 0; q < max_qp + 1; q++) {
1122 for (
x = 0;
x < 16;
x++)
1123 s->dequant4_coeff[q][(
x >> 2) | ((
x << 2) & 0xF)] =
1132 unsigned char *extradata;
1133 unsigned char *extradata_end;
1135 int marker_found = 0;
1141 if (!
s->next_pic || !
s->last_pic || !
s->cur_pic) {
1149 if (!
s->cur_pic->f || !
s->last_pic->f || !
s->next_pic->f)
1166 s->halfpel_flag = 1;
1167 s->thirdpel_flag = 1;
1168 s->has_watermark = 0;
1171 extradata = (
unsigned char *)avctx->
extradata;
1175 if (!memcmp(extradata,
"SEQH", 4)) {
1186 int frame_size_code;
1187 int unk0, unk1, unk2, unk3, unk4;
1191 if (
size > extradata_end - extradata - 8) {
1198 frame_size_code =
get_bits(&gb, 3);
1199 switch (frame_size_code) {
1252 unk0, unk1, unk2, unk3, unk4);
1261 if (
s->has_watermark) {
1269 unsigned long buf_len = watermark_width *
1270 watermark_height * 4;
1274 if (watermark_height <= 0 ||
1275 (uint64_t)watermark_width * 4 > UINT_MAX / watermark_height) {
1286 watermark_width, watermark_height);
1288 "u1: %x u2: %x u3: %x compressed data size: %d offset: %d\n",
1290 if (uncompress(buf, &buf_len, extradata + 8 +
offset,
1293 "could not uncompress watermark logo\n");
1300 s->watermark_key =
s->watermark_key << 16 |
s->watermark_key;
1302 "watermark key %#"PRIx32
"\n",
s->watermark_key);
1306 "this svq3 file contains watermark which need zlib support compiled in\n");
1313 s->mb_width = (avctx->
width + 15) / 16;
1314 s->mb_height = (avctx->
height + 15) / 16;
1315 s->mb_stride =
s->mb_width + 1;
1316 s->mb_num =
s->mb_width *
s->mb_height;
1317 s->b_stride = 4 *
s->mb_width;
1318 s->h_edge_pos =
s->mb_width * 16;
1319 s->v_edge_pos =
s->mb_height * 16;
1321 s->intra4x4_pred_mode =
av_mallocz(
s->mb_stride * 2 * 8);
1322 if (!
s->intra4x4_pred_mode)
1325 s->mb2br_xy =
av_mallocz(
s->mb_stride * (
s->mb_height + 1) *
1326 sizeof(*
s->mb2br_xy));
1330 for (y = 0; y <
s->mb_height; y++)
1331 for (
x = 0;
x <
s->mb_width;
x++) {
1332 const int mb_xy =
x + y *
s->mb_stride;
1334 s->mb2br_xy[mb_xy] = 8 * (mb_xy % (2 *
s->mb_stride));
1348 for (
i = 0;
i < 2;
i++) {
1360 const int big_mb_num =
s->mb_stride * (
s->mb_height + 1) + 1;
1361 const int mb_array_size =
s->mb_stride *
s->mb_height;
1362 const int b4_stride =
s->mb_width * 4 + 1;
1363 const int b4_array_size = b4_stride *
s->mb_height * 4;
1374 for (
i = 0;
i < 2;
i++) {
1393 if (!
s->edge_emu_buffer) {
1395 if (!
s->edge_emu_buffer)
1409 int buf_size = avpkt->
size;
1415 if (buf_size == 0) {
1416 if (
s->next_pic->f->data[0] && !
s->low_delay && !
s->last_frame_output) {
1420 s->last_frame_output = 1;
1426 s->mb_x =
s->mb_y =
s->mb_xy = 0;
1428 if (
s->watermark_key) {
1432 memcpy(
s->buf, avpkt->
data, buf_size);
1445 s->pict_type =
s->slice_type;
1453 s->cur_pic->f->pict_type =
s->pict_type;
1460 for (
i = 0;
i < 16;
i++) {
1462 s->block_offset[48 +
i] = (4 * ((
scan8[
i] -
scan8[0]) & 7)) + 8 *
s->cur_pic->f->linesize[0] * ((
scan8[
i] -
scan8[0]) >> 3);
1464 for (
i = 0;
i < 16;
i++) {
1465 s->block_offset[16 +
i] =
1466 s->block_offset[32 +
i] = (4 * ((
scan8[
i] -
scan8[0]) & 7)) + 4 *
s->cur_pic->f->linesize[1] * ((
scan8[
i] -
scan8[0]) >> 3);
1467 s->block_offset[48 + 16 +
i] =
1468 s->block_offset[48 + 32 +
i] = (4 * ((
scan8[
i] -
scan8[0]) & 7)) + 8 *
s->cur_pic->f->linesize[1] * ((
scan8[
i] -
scan8[0]) >> 3);
1472 if (!
s->last_pic->f->data[0]) {
1478 memset(
s->last_pic->f->data[0], 0, avctx->
height *
s->last_pic->f->linesize[0]);
1479 memset(
s->last_pic->f->data[1], 0x80, (avctx->
height / 2) *
1480 s->last_pic->f->linesize[1]);
1481 memset(
s->last_pic->f->data[2], 0x80, (avctx->
height / 2) *
1482 s->last_pic->f->linesize[2]);
1491 memset(
s->next_pic->f->data[0], 0, avctx->
height *
s->next_pic->f->linesize[0]);
1492 memset(
s->next_pic->f->data[1], 0x80, (avctx->
height / 2) *
1493 s->next_pic->f->linesize[1]);
1494 memset(
s->next_pic->f->data[2], 0x80, (avctx->
height / 2) *
1495 s->next_pic->f->linesize[2]);
1501 "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n",
1503 s->halfpel_flag,
s->thirdpel_flag,
1504 s->adaptive_quant,
s->qscale,
s->slice_num);
1511 if (
s->next_p_frame_damaged) {
1515 s->next_p_frame_damaged = 0;
1519 s->frame_num_offset =
s->slice_num -
s->prev_frame_num;
1521 if (
s->frame_num_offset < 0)
1522 s->frame_num_offset += 256;
1523 if (
s->frame_num_offset == 0 ||
1524 s->frame_num_offset >=
s->prev_frame_num_offset) {
1529 s->prev_frame_num =
s->frame_num;
1530 s->frame_num =
s->slice_num;
1531 s->prev_frame_num_offset =
s->frame_num -
s->prev_frame_num;
1533 if (
s->prev_frame_num_offset < 0)
1534 s->prev_frame_num_offset += 256;
1537 for (m = 0; m < 2; m++) {
1539 for (
i = 0;
i < 4;
i++) {
1541 for (j = -1; j < 4; j++)
1542 s->ref_cache[m][
scan8[0] + 8 *
i + j] = 1;
1548 for (
s->mb_y = 0;
s->mb_y <
s->mb_height;
s->mb_y++) {
1549 for (
s->mb_x = 0;
s->mb_x <
s->mb_width;
s->mb_x++) {
1551 s->mb_xy =
s->mb_x +
s->mb_y *
s->mb_stride;
1560 if (
s->slice_type !=
s->pict_type) {
1574 "error while decoding MB %d %d\n",
s->mb_x,
s->mb_y);
1578 if (mb_type != 0 ||
s->cbp)
1582 s->cur_pic->mb_type[
s->mb_x +
s->mb_y *
s->mb_stride] =
1587 s->last_pic->f->data[0] ?
s->last_pic->f :
NULL,
1594 if (
s->mb_y !=
s->mb_height ||
s->mb_x !=
s->mb_width) {
1606 else if (
s->last_pic->f->data[0])
1612 if (
s->last_pic->f->data[0] ||
s->low_delay)
uint8_t * edge_emu_buffer
static const uint32_t svq3_dequant_coeff[32]
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
enum AVPictureType slice_type
AVPixelFormat
Pixel format.
static av_cold int init(AVCodecContext *avctx)
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int svq3_decode_slice_header(AVCodecContext *avctx)
#define FFSWAP(type, a, b)
#define u(width, name, range_min, range_max)
uint8_t * data
The data buffer.
const uint8_t ff_h264_chroma_qp[7][QP_MAX_NUM+1]
static const int8_t mv[256][2]
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
unsigned int left_samples_available
static int get_bits_count(const GetBitContext *s)
static unsigned get_interleaved_ue_golomb(GetBitContext *gb)
const uint8_t ff_h264_golomb_to_inter_cbp[48]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
@ AVCOL_RANGE_JPEG
the normal 2^n-1 "JPEG" YUV ranges
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
static void free_picture(AVCodecContext *avctx, SVQ3Frame *pic)
AVBufferRef * av_buffer_allocz(int size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
const uint8_t ff_h264_golomb_to_intra4x4_cbp[48]
#define MB_TYPE_INTRA16x16
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define FF_DEBUG_PICT_INFO
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int get_buffer(AVCodecContext *avctx, SVQ3Frame *pic)
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
unsigned int topright_samples_available
enum AVDiscard skip_frame
Skip decoding for selected frames.
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 flags
AV_CODEC_FLAG_*.
av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
const uint8_t ff_h264_golomb_to_pict_type[5]
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int8_t intra4x4_pred_mode_cache[5 *8]
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
int has_b_frames
Size of the frame reordering buffer in the decoder.
enum AVPictureType pict_type
static int svq3_mc_dir(SVQ3Context *s, int size, int mode, int dir, int avg)
#define AV_GET_BUFFER_FLAG_REF
The decoder will keep a reference to the frame and may reuse it later.
av_cold void ff_tpeldsp_init(TpelDSPContext *c)
static enum AVPixelFormat pix_fmts[]
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_always_inline void svq3_pred_motion(const SVQ3Context *s, int n, int part_width, int list, int ref, int *const mx, int *const my)
Get the predicted MV.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
unsigned int top_samples_available
AVBufferRef * motion_val_buf[2]
int prev_frame_num_offset
av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags)
int16_t(*[2] motion_val)[2]
@ AVDISCARD_ALL
discard all
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
AVBufferRef * ref_index_buf[2]
@ AV_PICTURE_TYPE_I
Intra.
static unsigned int get_bits1(GetBitContext *s)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
const uint8_t ff_h264_chroma_dc_scan[4]
static const struct @135 svq3_dct_tables[2][16]
AVBufferRef * mb_type_buf
int16_t mb_luma_dc[3][16 *2]
static av_always_inline void hl_decode_mb_idct_luma(SVQ3Context *s, int mb_type, const int *block_offset, int linesize, uint8_t *dest_y)
Context for storing H.264 DSP functions.
@ AVDISCARD_NONKEY
discard all frames except keyframes
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static void init_dequant4_coeff_table(SVQ3Context *s)
const uint8_t ff_zigzag_scan[16+1]
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static av_always_inline int svq3_fetch_diagonal_mv(const SVQ3Context *s, const int16_t **C, int i, int list, int part_width)
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
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]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last, int y, int h, int picture_structure, int first_field, int low_delay)
Draw a horizontal band if supported.
static void hl_decode_mb(SVQ3Context *s)
static int get_interleaved_se_golomb(GetBitContext *gb)
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static const uint8_t header[24]
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
const uint8_t ff_h264_quant_rem6[QP_MAX_NUM+1]
static void skip_bits1(GetBitContext *s)
static av_always_inline void hl_decode_mb_predict_luma(SVQ3Context *s, int mb_type, const int *block_offset, int linesize, uint8_t *dest_y)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
#define AV_LOG_INFO
Standard information.
static av_always_inline uint32_t pack16to32(unsigned a, unsigned b)
static void svq3_add_idct_c(uint8_t *dst, int16_t *block, int stride, int qp, int dc)
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
#define DECLARE_ALIGNED(n, t, v)
static int svq3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)
#define i(width, name, range_min, range_max)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
int16_t mv_cache[2][5 *8][2]
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
const char * name
Name of the codec implementation.
uint8_t non_zero_count_cache[15 *8]
#define PART_NOT_AVAILABLE
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
static const uint8_t svq3_scan[16]
av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_format_idc)
static const int8_t svq3_pred_1[6][6][5]
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 ug o o w
#define AV_INPUT_BUFFER_PADDING_SIZE
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 int svq3_decode_block(GetBitContext *gb, int16_t *block, int index, const int type)
static int skip_1stop_8data_bits(GetBitContext *gb)
main external API structure.
const uint8_t ff_h264_dequant4_coeff_init[6][3]
int block_offset[2 *(16 *3)]
av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, int chroma_format_idc)
Set the intra prediction function pointers.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
int ff_h264_check_intra4x4_pred_mode(int8_t *pred_mode_cache, void *logctx, int top_samples_available, int left_samples_available)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...
const IMbInfo ff_h264_i_mb_type_info[26]
static void fill_rectangle(int x, int y, int w, int h)
static const uint8_t scan8[16 *3+3]
static int ref[MAX_W *MAX_W]
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
static const uint8_t luma_dc_zigzag_scan[16]
const uint8_t ff_h264_quant_div6[QP_MAX_NUM+1]
Context for storing H.264 prediction functions.
static int shift(int a, int b)
static void svq3_mc_dir_part(SVQ3Context *s, int x, int y, int width, int height, int mx, int my, int dxy, int thirdpel, int dir, int avg)
@ AV_PICTURE_TYPE_P
Predicted.
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.
A reference to a data buffer.
static int svq3_decode_end(AVCodecContext *avctx)
int frame_number
Frame counter, set by libavcodec.
#define avpriv_request_sample(...)
uint32_t dequant4_coeff[QP_MAX_NUM+1][16]
int8_t ref_cache[2][5 *8]
This structure stores compressed data.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
The exact code depends on how similar the blocks are and how related they are to the block
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static av_cold int svq3_decode_init(AVCodecContext *avctx)
@ AVDISCARD_NONREF
discard all non reference
int8_t * intra4x4_pred_mode
static const uint8_t svq3_pred_0[25][2]
int ff_h264_check_intra_pred_mode(void *logctx, int top_samples_available, int left_samples_available, int mode, int is_chroma)
Check if the top & left blocks are available if needed and change the dc mode so it only uses the ava...