42 return aa->
sym - bb->sym;
52 for (i = 0; i < 4; i++)
61 int i, subsampled_height;
62 uint32_t original_format;
82 "4:2:0 video requires even width and height.\n");
93 if (avctx->
width & 1) {
95 "4:2:2 video requires even width.\n");
116 "Prediction method %d is not supported in Ut Video.\n",
123 "Plane prediction is not supported in Ut Video.\n");
141 "Slice count %d is not supported in Ut Video (theoretical range is 0-256).\n",
148 if (avctx->
slices > subsampled_height) {
150 "Slice count %d is larger than the subsampling-applied height %d.\n",
151 avctx->
slices, subsampled_height);
175 for (i = 0; i < c->
planes; i++) {
208 c->
slices = subsampled_height / 120;
241 int k = 2 * dst_stride;
244 for (j = 0; j <
height; j++) {
246 for (i = 0; i < width * step; i += step) {
250 dst[1][k] = src[i + 2] -
g;
251 dst[2][k] = src[i + 0] -
g;
255 for (i = 0; i < width * step; i += step) {
259 dst[1][k] = src[i + 2] -
g;
260 dst[2][k] = src[i + 0] -
g;
261 dst[3][k] = src[i + 3];
265 k += dst_stride -
width;
278 for (j = 0; j <
height; j++) {
279 for (i = 0; i <
width; i++) {
280 *dst++ = src[i] - prev;
297 for (i = 0; i <
width; i++) {
298 *dst++ = src[i] - prev;
314 for (j = 1; j <
height; j++) {
323 int height, uint64_t *counts)
327 for (j = 0; j <
height; j++) {
328 for (i = 0; i <
width; i++) {
344 while (he[last].
len == 255 && last)
348 for (i = last; i >= 0; i--) {
349 he[i].
code = code >> (32 - he[i].
len);
350 code += 0x80000000
u >> (he[i].
len - 1);
367 for (j = 0; j <
height; j++) {
368 for (i = 0; i <
width; i++)
395 uint64_t counts[256] = { 0 };
399 uint32_t
offset = 0, slice_len = 0;
400 int i, sstart, send = 0;
407 for (i = 0; i < c->
slices; i++) {
409 send = height * (i + 1) / c->
slices;
411 src + sstart * stride, stride,
412 width, send - sstart);
416 for (i = 0; i < c->
slices; i++) {
418 send = height * (i + 1) / c->
slices;
419 left_predict(src + sstart * stride, dst + sstart * width,
420 stride, width, send - sstart);
424 for (i = 0; i < c->
slices; i++) {
426 send = height * (i + 1) / c->
slices;
428 stride, width, send - sstart);
441 for (symbol = 0; symbol < 256; symbol++) {
443 if (counts[symbol]) {
445 if (counts[symbol] == width * (int64_t)height) {
450 for (i = 0; i < 256; i++) {
452 bytestream2_put_byte(pb, 0);
454 bytestream2_put_byte(pb, 0xFF);
458 for (i = 0; i < c->
slices; i++)
459 bytestream2_put_le32(pb, 0);
477 for (i = 0; i < 256; i++) {
478 bytestream2_put_byte(pb, lengths[i]);
480 he[i].
len = lengths[i];
488 for (i = 0; i < c->
slices; i++) {
490 send = height * (i + 1) / c->
slices;
497 width * height + 4, width,
498 send - sstart, he) >> 3;
500 slice_len = offset - slice_len;
508 bytestream2_put_le32(pb, offset);
512 offset - slice_len, SEEK_CUR);
531 const AVFrame *pic,
int *got_packet)
570 for (i = 0; i < c->
planes; i++) {
582 for (i = 0; i < c->
planes; i++) {
584 pic->
linesize[i], width >> !!i, height, &pb);
593 for (i = 0; i < c->
planes; i++) {
595 pic->
linesize[i], width >> !!i, height >> !!i,
616 bytestream2_put_le32(&pb, frame_info);