46 s->
llviddsp.
diff_int16((uint16_t *)dst, (
const uint16_t *)src0, (
const uint16_t *)src1, s->
n - 1, w);
56 for (i = 0; i < w; i++) {
57 const int temp = src[i];
63 for (i = 0; i < 16; i++) {
64 const int temp = src[i];
72 const uint16_t *src16 = (
const uint16_t *)src;
73 uint16_t *dst16 = ( uint16_t *)dst;
75 for (i = 0; i < w; i++) {
76 const int temp = src16[i];
77 dst16[i] = temp - left;
82 for (i = 0; i < 16; i++) {
83 const int temp = src16[i];
84 dst16[i] = temp - left;
95 int *red,
int *green,
int *blue,
105 for (i = 0; i <
FFMIN(w, 4); i++) {
106 const int rt = src[i * 4 +
R];
107 const int gt = src[i * 4 +
G];
108 const int bt = src[i * 4 +
B];
109 const int at = src[i * 4 +
A];
110 dst[i * 4 +
R] = rt -
r;
111 dst[i * 4 +
G] = gt -
g;
112 dst[i * 4 +
B] = bt -
b;
113 dst[i * 4 +
A] = at -
a;
122 *red = src[(w - 1) * 4 +
R];
123 *green = src[(w - 1) * 4 +
G];
124 *blue = src[(w - 1) * 4 +
B];
125 *alpha = src[(w - 1) * 4 +
A];
130 int *red,
int *green,
int *blue)
137 for (i = 0; i <
FFMIN(w, 16); i++) {
138 const int rt = src[i * 3 + 0];
139 const int gt = src[i * 3 + 1];
140 const int bt = src[i * 3 + 2];
141 dst[i * 3 + 0] = rt -
r;
142 dst[i * 3 + 1] = gt -
g;
143 dst[i * 3 + 2] = bt -
b;
151 *red = src[(w - 1) * 3 + 0];
152 *green = src[(w - 1) * 3 + 1];
153 *blue = src[(w - 1) * 3 + 2];
171 for (i = 0; i <
n;) {
175 for (; i < n && len[i] == val && repeat < 255; i++)
178 av_assert0(val < 32 && val >0 && repeat < 256 && repeat>0);
181 buf[index++] = repeat;
183 buf[index++] = val | (repeat << 5);
199 for (i = 0; i <
count; i++) {
226 #define STATS_OUT_SIZE 21*MAX_N*3 + 4
321 "context=1 is not compatible with "
322 "2 pass huffyuv encoding\n");
330 "Error: YV12 is not supported by huffyuv; use "
331 "vcodec=ffvhuff or format=422p\n");
336 "Error: per-frame huffman tables are not supported "
337 "by huffyuv; use vcodec=ffvhuff\n");
342 "Error: ver>2 is not supported "
343 "by huffyuv; use vcodec=ffvhuff\n");
348 "using huffyuv 2.2.0 or newer interlacing flag\n");
352 av_log(avctx,
AV_LOG_ERROR,
"Ver > 3 is under development, files encoded with it may not be decodable with future versions!!!\n"
353 "Use vstrict=-2 / -strict -2 to use it anyway.\n");
359 "Error: RGB is incompatible with median predictor\n");
383 for (i = 0; i < 4; i++)
384 for (j = 0; j < s->
vlc_n; j++)
388 for (i = 0; i < 4; i++) {
391 for (j = 0; j < s->
vlc_n; j++) {
392 s->
stats[i][j] += strtol(p, &next, 0);
393 if (next == p)
return -1;
397 if (p[0] == 0 || p[1] == 0 || p[2] == 0)
break;
400 for (i = 0; i < 4; i++)
401 for (j = 0; j < s->
vlc_n; j++) {
404 s->
stats[i][j] = 100000000 / (d*d + 1);
414 for (i = 0; i < 4; i++) {
416 for (j = 0; j < s->
vlc_n; j++) {
418 s->
stats[i][j] = pels/(d*d + 1);
422 for (i = 0; i < 4; i++)
423 for (j = 0; j < s->
vlc_n; j++)
450 int y1 = y[2 * i + 1];\
457 for(i = 0; i <
count; i++) {
468 for (i = 0; i <
count; i++) {
480 for(i = 0; i <
count; i++) {
493 int i,
count = width/2;
501 int y0 = s->temp[0][width-1];
503 int y0 = s->temp16[0][width-1] & mask;
505 int y0 = s->temp16[0][width-1];
507 s->stats[plane][y0]++;
509 s->stats[plane][y0>>2]++;
511 put_bits(&s->pb, s->len[plane][y0], s->bits[plane][y0]);
513 put_bits(&s->pb, s->len[plane][y0>>2], s->bits[plane][y0>>2]);\
514 put_bits(&s->pb, 2, y0&3);
517 int y0 = s->temp[0][2 * i];\
518 int y1 = s->temp[0][2 * i + 1];
520 int y0 = s->temp16[0][2 * i] & mask;\
521 int y1 = s->temp16[0][2 * i + 1] & mask;
523 int y0 = s->temp16[0][2 * i];\
524 int y1 = s->temp16[0][2 * i + 1];
526 s->stats[plane][y0]++;\
527 s->stats[plane][y1]++;
529 s->stats[plane][y0>>2]++;\
530 s->stats[plane][y1>>2]++;
532 put_bits(&s->pb, s->len[plane][y0], s->bits[plane][y0]);\
533 put_bits(&s->pb, s->len[plane][y1], s->bits[plane][y1]);
535 put_bits(&s->pb, s->len[plane][y0>>2], s->bits[plane][y0>>2]);\
536 put_bits(&s->pb, 2, y0&3);\
537 put_bits(&s->pb, s->len[plane][y1>>2], s->bits[plane][y1>>2]);\
538 put_bits(&s->pb, 2, y1&3);
542 for (i = 0; i <
count; i++) {
555 for (i = 0; i <
count; i++) {
566 for (i = 0; i <
count; i++) {
575 }
else if (s->
bps <= 14) {
578 for (i = 0; i <
count; i++) {
591 for (i = 0; i <
count; i++) {
602 for (i = 0; i <
count; i++) {
613 for (i = 0; i <
count; i++) {
626 for (i = 0; i <
count; i++) {
637 for (i = 0; i <
count; i++) {
663 int y0 = s->temp[0][2 * i];\
664 int y1 = s->temp[0][2 * i + 1];
669 put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);\
670 put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
675 for (i = 0; i <
count; i++) {
684 for (i = 0; i <
count; i++) {
690 for (i = 0; i <
count; i++) {
703 4 * planes * count) {
709 int g = s->temp[0][planes == 3 ? 3 * i + 1 : 4 * i + G]; \
710 int b =(s->temp[0][planes == 3 ? 3 * i + 2 : 4 * i + B] - g) & 0xFF;\
711 int r =(s->temp[0][planes == 3 ? 3 * i + 0 : 4 * i + R] - g) & 0xFF;\
712 int a = s->temp[0][planes * i + A];
722 put_bits(&s->pb, s->len[1][g], s->bits[1][g]); \
723 put_bits(&s->pb, s->len[0][b], s->bits[0][b]); \
724 put_bits(&s->pb, s->len[2][r], s->bits[2][r]); \
726 put_bits(&s->pb, s->len[2][a], s->bits[2][a]);
730 for (i = 0; i <
count; i++) {
735 for (i = 0; i <
count; i++) {
741 for (i = 0; i <
count; i++) {
750 const AVFrame *pict,
int *got_packet)
754 const int width2 = s->
width>>1;
759 const AVFrame *
const p = pict;
770 for (i = 0; i < 4; i++)
771 for (j = 0; j < s->
vlc_n; j++)
772 s->
stats[i][j] >>= 1;
779 int lefty, leftu, leftv,
y, cy;
793 int lefttopy, lefttopu, lefttopv;
810 lefttopy = p->
data[0][3];
811 lefttopu = p->
data[1][1];
812 lefttopv = p->
data[2][1];
819 for (; y <
height; y++,cy++) {
829 if (y >= height)
break;
842 for (cy = y = 1; y <
height; y++, cy++) {
858 if (y >= height)
break;
885 const int fake_stride = -fake_ystride;
887 int leftr, leftg, leftb, lefta;
895 &leftr, &leftg, &leftb, &lefta);
903 &leftr, &leftg, &leftb, &lefta);
906 &leftr, &leftg, &leftb, &lefta);
913 const int fake_stride = -fake_ystride;
915 int leftr, leftg, leftb;
923 &leftr, &leftg, &leftb);
932 &leftr, &leftg, &leftb);
935 &leftr, &leftg, &leftb);
941 for (plane = 0; plane < 1 + 2*s->
chroma + s->
alpha; plane++) {
945 int fake_stride = fake_ystride;
947 if (s->
chroma && (plane == 1 || plane == 2)) {
950 fake_stride = plane == 1 ? fake_ustride : fake_vstride;
967 lefttop = p->
data[plane][0];
977 for (y = 1; y < h; y++) {
1006 for (i = 0; i < 4; i++) {
1007 for (j = 0; j < s->
vlc_n; j++) {
1026 pkt->
size = size * 4;
1048 {
"non_deterministic",
"Allow multithreading for e.g. context=1 at the expense of determinism",
1078 .priv_class = &normal_class,
1085 #if CONFIG_FFVHUFF_ENCODER
1086 AVCodec ff_ffvhuff_encoder = {
1096 .priv_class = &ff_class,