43 return aa->
sym - bb->sym;
53 for (i = 0; i < 4; i++)
62 int i, subsampled_height;
63 uint32_t original_format;
83 "4:2:0 video requires even width and height.\n");
94 if (avctx->
width & 1) {
96 "4:2:2 video requires even width.\n");
118 "Prediction method %d is not supported in Ut Video.\n",
125 "Plane prediction is not supported in Ut Video.\n");
143 "Slice count %d is not supported in Ut Video (theoretical range is 0-256).\n",
150 if (avctx->
slices > subsampled_height) {
152 "Slice count %d is larger than the subsampling-applied height %d.\n",
153 avctx->
slices, subsampled_height);
177 for (i = 0; i < c->
planes; i++) {
210 c->
slices = subsampled_height / 120;
243 int k = 2 * dst_stride;
246 for (j = 0; j <
height; j++) {
248 for (i = 0; i < width * step; i += step) {
252 dst[1][k] = src[i + 2] -
g;
253 dst[2][k] = src[i + 0] -
g;
257 for (i = 0; i < width * step; i += step) {
261 dst[1][k] = src[i + 2] -
g;
262 dst[2][k] = src[i + 0] -
g;
263 dst[3][k] = src[i + 3];
267 k += dst_stride -
width;
280 for (j = 0; j <
height; j++) {
281 for (i = 0; i <
width; i++) {
282 *dst++ = src[i] - prev;
299 for (i = 0; i <
width; i++) {
300 *dst++ = src[i] - prev;
316 for (j = 1; j <
height; j++) {
325 int height, uint64_t *counts)
329 for (j = 0; j <
height; j++) {
330 for (i = 0; i <
width; i++) {
346 while (he[last].
len == 255 && last)
350 for (i = last; i >= 0; i--) {
351 he[i].
code = code >> (32 - he[i].
len);
352 code += 0x80000000
u >> (he[i].
len - 1);
369 for (j = 0; j <
height; j++) {
370 for (i = 0; i <
width; i++)
397 uint64_t counts[256] = { 0 };
401 uint32_t
offset = 0, slice_len = 0;
403 int i, sstart, send = 0;
410 for (i = 0; i < c->
slices; i++) {
412 send = height * (i + 1) / c->
slices & cmask;
414 src + sstart * stride, stride,
415 width, send - sstart);
419 for (i = 0; i < c->
slices; i++) {
421 send = height * (i + 1) / c->
slices & cmask;
422 left_predict(src + sstart * stride, dst + sstart * width,
423 stride, width, send - sstart);
427 for (i = 0; i < c->
slices; i++) {
429 send = height * (i + 1) / c->
slices & cmask;
431 stride, width, send - sstart);
444 for (symbol = 0; symbol < 256; symbol++) {
446 if (counts[symbol]) {
448 if (counts[symbol] == width * (int64_t)height) {
453 for (i = 0; i < 256; i++) {
455 bytestream2_put_byte(pb, 0);
457 bytestream2_put_byte(pb, 0xFF);
461 for (i = 0; i < c->
slices; i++)
462 bytestream2_put_le32(pb, 0);
480 for (i = 0; i < 256; i++) {
481 bytestream2_put_byte(pb, lengths[i]);
483 he[i].
len = lengths[i];
491 for (i = 0; i < c->
slices; i++) {
493 send = height * (i + 1) / c->
slices & cmask;
500 width * height + 4, width,
501 send - sstart, he) >> 3;
503 slice_len = offset - slice_len;
511 bytestream2_put_le32(pb, offset);
515 offset - slice_len, SEEK_CUR);
534 const AVFrame *pic,
int *got_packet)
573 for (i = 0; i < c->
planes; i++) {
585 for (i = 0; i < c->
planes; i++) {
587 pic->
linesize[i], i, width >> !!i, height, &pb);
596 for (i = 0; i < c->
planes; i++) {
598 pic->
linesize[i], i, width >> !!i, height >> !!i,
619 bytestream2_put_le32(&pb, frame_info);