44 s->
llviddsp.
diff_int16((uint16_t *)dst, (
const uint16_t *)src0, (
const uint16_t *)src1, s->
n - 1, w);
54 for (i = 0; i < w; i++) {
55 const int temp = src[i];
61 for (i = 0; i < 16; i++) {
62 const int temp = src[i];
70 const uint16_t *src16 = (
const uint16_t *)src;
71 uint16_t *dst16 = ( uint16_t *)dst;
73 for (i = 0; i < w; i++) {
74 const int temp = src16[i];
75 dst16[i] = temp - left;
80 for (i = 0; i < 16; i++) {
81 const int temp = src16[i];
82 dst16[i] = temp - left;
93 int *red,
int *green,
int *blue,
103 for (i = 0; i <
FFMIN(w, 4); i++) {
104 const int rt = src[i * 4 +
R];
105 const int gt = src[i * 4 +
G];
106 const int bt = src[i * 4 +
B];
107 const int at = src[i * 4 +
A];
108 dst[i * 4 +
R] = rt -
r;
109 dst[i * 4 +
G] = gt -
g;
110 dst[i * 4 +
B] = bt -
b;
111 dst[i * 4 +
A] = at -
a;
120 *red = src[(w - 1) * 4 +
R];
121 *green = src[(w - 1) * 4 +
G];
122 *blue = src[(w - 1) * 4 +
B];
123 *alpha = src[(w - 1) * 4 +
A];
128 int *red,
int *green,
int *blue)
135 for (i = 0; i <
FFMIN(w, 16); i++) {
136 const int rt = src[i * 3 + 0];
137 const int gt = src[i * 3 + 1];
138 const int bt = src[i * 3 + 2];
139 dst[i * 3 + 0] = rt -
r;
140 dst[i * 3 + 1] = gt -
g;
141 dst[i * 3 + 2] = bt -
b;
147 s->
dsp.
diff_bytes(dst + 48, src + 48, src + 48 - 3, w * 3 - 48);
149 *red = src[(w - 1) * 3 + 0];
150 *green = src[(w - 1) * 3 + 1];
151 *blue = src[(w - 1) * 3 + 2];
169 for (i = 0; i <
n;) {
173 for (; i < n && len[i] == val && repeat < 255; i++)
176 av_assert0(val < 32 && val >0 && repeat < 256 && repeat>0);
179 buf[index++] = repeat;
181 buf[index++] = val | (repeat << 5);
197 for (i = 0; i <
count; i++) {
223 #define STATS_OUT_SIZE 21*MAX_N*3 + 4
318 "context=1 is not compatible with "
319 "2 pass huffyuv encoding\n");
327 "Error: YV12 is not supported by huffyuv; use "
328 "vcodec=ffvhuff or format=422p\n");
333 "Error: per-frame huffman tables are not supported "
334 "by huffyuv; use vcodec=ffvhuff\n");
339 "Error: ver>2 is not supported "
340 "by huffyuv; use vcodec=ffvhuff\n");
345 "using huffyuv 2.2.0 or newer interlacing flag\n");
349 av_log(avctx,
AV_LOG_ERROR,
"Ver > 2 is under development, files encoded with it may not be decodable with future versions!!!\n"
350 "Use vstrict=-2 / -strict -2 to use it anyway.\n");
356 "Error: RGB is incompatible with median predictor\n");
380 for (i = 0; i < 4; i++)
381 for (j = 0; j < s->
vlc_n; j++)
385 for (i = 0; i < 4; i++) {
388 for (j = 0; j < s->
vlc_n; j++) {
389 s->
stats[i][j] += strtol(p, &next, 0);
390 if (next == p)
return -1;
394 if (p[0] == 0 || p[1] == 0 || p[2] == 0)
break;
397 for (i = 0; i < 4; i++)
398 for (j = 0; j < s->
vlc_n; j++) {
401 s->
stats[i][j] = 100000000 / (d + 1);
411 for (i = 0; i < 4; i++) {
413 for (j = 0; j < s->
vlc_n; j++) {
415 s->
stats[i][j] = pels/(d + 1);
419 for (i = 0; i < 4; i++)
420 for (j = 0; j < s->
vlc_n; j++)
447 int y1 = y[2 * i + 1];\
454 for(i = 0; i <
count; i++) {
465 for (i = 0; i <
count; i++) {
477 for(i = 0; i <
count; i++) {
498 int y0 = s->temp[0][2 * i];\
499 int y1 = s->temp[0][2 * i + 1];
501 int y0 = s->temp16[0][2 * i] & mask;\
502 int y1 = s->temp16[0][2 * i + 1] & mask;
504 int y0 = s->temp16[0][2 * i];\
505 int y1 = s->temp16[0][2 * i + 1];
507 s->stats[plane][y0]++;\
508 s->stats[plane][y1]++;
510 s->stats[plane][y0>>2]++;\
511 s->stats[plane][y1>>2]++;
513 put_bits(&s->pb, s->len[plane][y0], s->bits[plane][y0]);\
514 put_bits(&s->pb, s->len[plane][y1], s->bits[plane][y1]);
516 put_bits(&s->pb, s->len[plane][y0>>2], s->bits[plane][y0>>2]);\
517 put_bits(&s->pb, 2, y0&3);\
518 put_bits(&s->pb, s->len[plane][y1>>2], s->bits[plane][y1>>2]);\
519 put_bits(&s->pb, 2, y1&3);
525 for (i = 0; i <
count; i++) {
534 for (i = 0; i <
count; i++) {
540 for (i = 0; i <
count; i++) {
545 }
else if (s->
bps <= 14) {
548 for (i = 0; i <
count; i++) {
557 for (i = 0; i <
count; i++) {
563 for (i = 0; i <
count; i++) {
570 for (i = 0; i <
count; i++) {
579 for (i = 0; i <
count; i++) {
585 for (i = 0; i <
count; i++) {
607 int y0 = s->temp[0][2 * i];\
608 int y1 = s->temp[0][2 * i + 1];
613 put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);\
614 put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
619 for (i = 0; i <
count; i++) {
628 for (i = 0; i <
count; i++) {
634 for (i = 0; i <
count; i++) {
647 4 * planes * count) {
653 int g = s->temp[0][planes == 3 ? 3 * i + 1 : 4 * i + G]; \
654 int b =(s->temp[0][planes == 3 ? 3 * i + 2 : 4 * i + B] - g) & 0xFF;\
655 int r =(s->temp[0][planes == 3 ? 3 * i + 0 : 4 * i + R] - g) & 0xFF;\
656 int a = s->temp[0][planes * i + A];
666 put_bits(&s->pb, s->len[1][g], s->bits[1][g]); \
667 put_bits(&s->pb, s->len[0][b], s->bits[0][b]); \
668 put_bits(&s->pb, s->len[2][r], s->bits[2][r]); \
670 put_bits(&s->pb, s->len[2][a], s->bits[2][a]);
674 for (i = 0; i <
count; i++) {
679 for (i = 0; i <
count; i++) {
685 for (i = 0; i <
count; i++) {
694 const AVFrame *pict,
int *got_packet)
698 const int width2 = s->
width>>1;
703 const AVFrame *
const p = pict;
714 for (i = 0; i < 4; i++)
715 for (j = 0; j < s->
vlc_n; j++)
716 s->
stats[i][j] >>= 1;
723 int lefty, leftu, leftv,
y, cy;
737 int lefttopy, lefttopu, lefttopv;
754 lefttopy = p->
data[0][3];
755 lefttopu = p->
data[1][1];
756 lefttopv = p->
data[2][1];
763 for (; y <
height; y++,cy++) {
773 if (y >= height)
break;
786 for (cy = y = 1; y <
height; y++, cy++) {
802 if (y >= height)
break;
829 const int fake_stride = -fake_ystride;
831 int leftr, leftg, leftb, lefta;
839 &leftr, &leftg, &leftb, &lefta);
847 &leftr, &leftg, &leftb, &lefta);
850 &leftr, &leftg, &leftb, &lefta);
857 const int fake_stride = -fake_ystride;
859 int leftr, leftg, leftb;
867 &leftr, &leftg, &leftb);
876 &leftr, &leftg, &leftb);
879 &leftr, &leftg, &leftb);
885 for (plane = 0; plane < 1 + 2*s->
chroma + s->
alpha; plane++) {
889 int fake_stride = fake_ystride;
891 if (s->
chroma && (plane == 1 || plane == 2)) {
894 fake_stride = plane == 1 ? fake_ustride : fake_vstride;
911 lefttop = p->
data[plane][0];
921 for (y = 1; y < h; y++) {
950 for (i = 0; i < 4; i++) {
951 for (j = 0; j < s->
vlc_n; j++) {
970 pkt->
size = size * 4;
991 #if CONFIG_HUFFYUV_ENCODER
1009 #if CONFIG_FFVHUFF_ENCODER
1010 AVCodec ff_ffvhuff_encoder = {