Lines Matching refs:vdec

195 	struct vdec_t *vdec = inst->priv;
201 vdec->params.display_delay_enable = ctrl->val;
204 vdec->params.display_delay = ctrl->val;
265 struct vdec_t *vdec = inst->priv;
273 if (!vdec->source_change)
280 vdec->source_change--;
287 struct vdec_t *vdec = inst->priv;
292 vdec->state = inst->state;
294 vdec->state = VPU_CODEC_STATE_ACTIVE;
299 vdec->state = VPU_CODEC_STATE_DYAMIC_RESOLUTION_CHANGE;
313 struct vdec_t *vdec = inst->priv;
318 if (vdec->eos_received) {
320 vdec->eos_received--;
338 struct vdec_t *vdec = inst->priv;
343 if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) {
367 struct vdec_t *vdec = inst->priv;
386 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries;
387 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars;
388 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs;
389 f->fmt.pix_mp.quantization = vdec->codec_info.full_range;
398 struct vdec_t *vdec = inst->priv;
402 if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) {
412 if (vdec->fixed_fmt) {
413 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries;
414 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars;
415 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs;
416 f->fmt.pix_mp.quantization = vdec->codec_info.full_range;
434 struct vdec_t *vdec = inst->priv;
452 vdec->reset_codec = true;
453 vdec->fixed_fmt = false;
456 if (V4L2_TYPE_IS_OUTPUT(f->type) || !vdec->fixed_fmt) {
474 if (!vdec->fixed_fmt) {
476 vdec->params.codec_format = cur_fmt->pixfmt;
477 vdec->codec_info.color_primaries = f->fmt.pix_mp.colorspace;
478 vdec->codec_info.transfer_chars = f->fmt.pix_mp.xfer_func;
479 vdec->codec_info.matrix_coeffs = f->fmt.pix_mp.ycbcr_enc;
480 vdec->codec_info.full_range = f->fmt.pix_mp.quantization;
482 vdec->params.output_format = cur_fmt->pixfmt;
505 struct vdec_t *vdec = inst->priv;
513 if (V4L2_TYPE_IS_OUTPUT(f->type) && !vdec->fixed_fmt) {
524 f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries;
525 f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars;
526 f->fmt.pix_mp.ycbcr_enc = vdec->codec_info.matrix_coeffs;
527 f->fmt.pix_mp.quantization = vdec->codec_info.full_range;
562 struct vdec_t *vdec = inst->priv;
567 if (!vdec->drain)
573 if (!vdec->params.frame_count) {
579 vdec->params.end_flag = 1;
580 vpu_iface_set_decode_params(inst, &vdec->params, 1);
581 vdec->drain = 0;
582 vpu_trace(inst->dev, "[%d] frame_count = %d\n", inst->id, vdec->params.frame_count);
589 struct vdec_t *vdec = inst->priv;
601 if (vdec->eos_received)
608 struct vdec_t *vdec = inst->priv;
615 vdec->drain = 1;
691 struct vdec_t *vdec = inst->priv;
696 if (vdec->req_frame_count)
712 struct vdec_t *vdec = inst->priv;
719 if (!info || info->id >= ARRAY_SIZE(vdec->slots))
723 vpu_buf = vdec->slots[info->id];
744 vdec->decoded_frame_count++;
745 if (vdec->params.display_delay_enable) {
754 vbuf->sequence = vdec->sequence++;
758 vdec->display_frame_count++;
768 struct vdec_t *vdec = inst->priv;
771 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) {
772 if (!vdec->slots[i])
774 if (luma == vdec->slots[i]->luma)
775 return vdec->slots[i];
783 struct vdec_t *vdec = inst->priv;
793 if (!vdec->params.display_delay_enable)
794 vdec->sequence++;
813 if (vpu_get_buffer_state(vbuf) == VPU_BUF_STATE_READY && vdec->params.display_delay_enable)
823 vbuf->sequence = vdec->sequence;
828 vdec->display_frame_count++;
831 inst->id, vdec->decoded_frame_count, vdec->display_frame_count, vdec->sequence);
836 struct vdec_t *vdec = inst->priv;
840 vdec->seq_hdr_found = 0;
841 vdec->req_frame_count = 0;
842 vdec->reset_codec = false;
843 vdec->fixed_fmt = false;
844 vdec->params.end_flag = 0;
845 vdec->drain = 0;
846 vdec->params.frame_count = 0;
847 vdec->decoded_frame_count = 0;
848 vdec->display_frame_count = 0;
849 vdec->sequence = 0;
850 vdec->eos_received = 0;
851 vdec->is_source_changed = false;
852 vdec->source_change = 0;
859 struct vdec_t *vdec = inst->priv;
865 if (vdec->reset_codec)
869 if (sibling && vdec->codec_info.pixfmt == sibling->pixfmt)
870 vdec->codec_info.pixfmt = inst->cap_format.pixfmt;
874 if (inst->cap_format.pixfmt != vdec->codec_info.pixfmt)
876 if (inst->cap_format.width != vdec->codec_info.decoded_width)
878 if (inst->cap_format.height != vdec->codec_info.decoded_height)
882 if (inst->crop.left != vdec->codec_info.offset_x)
884 if (inst->crop.top != vdec->codec_info.offset_y)
886 if (inst->crop.width != vdec->codec_info.width)
888 if (inst->crop.height != vdec->codec_info.height)
896 struct vdec_t *vdec = inst->priv;
901 f.fmt.pix_mp.pixelformat = vdec->codec_info.pixfmt;
902 f.fmt.pix_mp.width = vdec->codec_info.decoded_width;
903 f.fmt.pix_mp.height = vdec->codec_info.decoded_height;
904 if (vdec->codec_info.progressive)
910 inst->out_format.width = vdec->codec_info.width;
911 inst->out_format.height = vdec->codec_info.height;
916 struct vdec_t *vdec = inst->priv;
918 inst->crop.left = vdec->codec_info.offset_x;
919 inst->crop.top = vdec->codec_info.offset_y;
920 inst->crop.width = vdec->codec_info.width;
921 inst->crop.height = vdec->codec_info.height;
926 struct vdec_t *vdec = inst->priv;
928 vdec->mbi.size = vdec->codec_info.mbi_size;
929 vdec->mbi.max_count = ARRAY_SIZE(vdec->mbi.buffer);
930 scnprintf(vdec->mbi.name, sizeof(vdec->mbi.name), "mbi");
931 vdec->mbi.type = MEM_RES_MBI;
932 vdec->mbi.tag = vdec->seq_tag;
937 struct vdec_t *vdec = inst->priv;
939 vdec->dcp.size = vdec->codec_info.dcp_size;
940 vdec->dcp.max_count = ARRAY_SIZE(vdec->dcp.buffer);
941 scnprintf(vdec->dcp.name, sizeof(vdec->dcp.name), "dcp");
942 vdec->dcp.type = MEM_RES_DCP;
943 vdec->dcp.tag = vdec->seq_tag;
1020 struct vdec_t *vdec = inst->priv;
1024 if (!vdec->req_frame_count)
1029 info.tag = vdec->seq_tag + 0xf0;
1033 vdec->req_frame_count--;
1040 struct vdec_t *vdec = inst->priv;
1048 if (vdec->aborting)
1051 if (!vdec->req_frame_count)
1057 if (vdec->slots[vbuf->vb2_buf.index]) {
1064 inst->id, vpu_codec_state_name(inst->state), vbuf->vb2_buf.index, vdec->seq_tag);
1070 info.tag = vdec->seq_tag;
1088 vdec->slots[info.id] = vpu_buf;
1089 vdec->req_frame_count--;
1096 struct vdec_t *vdec = inst->priv;
1101 for (i = vdec->req_frame_count; i > 0; i--)
1106 for (i = vdec->req_frame_count; i > 0; i--) {
1110 if (vdec->eos_received)
1114 for (i = vdec->mbi.index; i < vdec->mbi.count; i++) {
1115 if (vdec_response_fs(inst, &vdec->mbi))
1117 if (vdec->eos_received)
1120 for (i = vdec->dcp.index; i < vdec->dcp.count; i++) {
1121 if (vdec_response_fs(inst, &vdec->dcp))
1123 if (vdec->eos_received)
1151 struct vdec_t *vdec = inst->priv;
1156 for (i = 0; i < ARRAY_SIZE(vdec->slots); i++) {
1157 if (!vdec->slots[i])
1160 vpu_buf = vdec->slots[i];
1166 vdec->slots[i]->state = VPU_BUF_STATE_IDLE;
1167 vdec->slots[i] = NULL;
1173 struct vdec_t *vdec = inst->priv;
1176 memcpy(&vdec->codec_info, hdr, sizeof(vdec->codec_info));
1180 vdec->codec_info.decoded_width,
1181 vdec->codec_info.decoded_height,
1182 vdec->codec_info.offset_x,
1183 vdec->codec_info.offset_y,
1184 vdec->codec_info.width,
1185 vdec->codec_info.height,
1189 vdec->is_source_changed = vdec_check_source_change(inst);
1194 if (!vdec->seq_hdr_found) {
1195 vdec->seq_tag = vdec->codec_info.tag;
1196 if (vdec->is_source_changed) {
1198 vdec->source_change++;
1200 vdec->is_source_changed = false;
1203 if (vdec->seq_tag != vdec->codec_info.tag) {
1206 inst->id, vdec->seq_tag, vdec->codec_info.tag);
1208 vdec->seq_hdr_found++;
1209 vdec->fixed_fmt = true;
1215 struct vdec_t *vdec = inst->priv;
1219 vdec->seq_tag = vdec->codec_info.tag;
1220 vdec_clear_fs(&vdec->mbi);
1221 vdec_clear_fs(&vdec->dcp);
1225 if (vdec->is_source_changed) {
1227 vdec->source_change++;
1229 vdec->is_source_changed = false;
1236 struct vdec_t *vdec = inst->priv;
1245 vdec->req_frame_count++;
1248 vdec_request_one_fs(&vdec->mbi);
1251 vdec_request_one_fs(&vdec->dcp);
1257 vdec_alloc_fs(inst, &vdec->mbi);
1258 vdec_alloc_fs(inst, &vdec->dcp);
1267 struct vdec_t *vdec = inst->priv;
1271 if (!fs || fs->id >= ARRAY_SIZE(vdec->slots))
1282 vpu_buf = vdec->slots[fs->id];
1283 vdec->slots[fs->id] = NULL;
1293 vdec->sequence++;
1309 struct vdec_t *vdec = inst->priv;
1313 vdec->params.frame_count,
1314 vdec->decoded_frame_count,
1315 vdec->display_frame_count,
1316 vdec->sequence);
1318 vdec->eos_received++;
1319 vdec->fixed_fmt = false;
1350 struct vdec_t *vdec = inst->priv;
1362 if (vdec->reset_codec)
1382 vdec->params.frame_count++;
1384 if (vdec->drain)
1392 struct vdec_t *vdec = inst->priv;
1398 if (vdec->reset_codec)
1410 struct vdec_t *vdec = inst->priv;
1416 if (vdec->eos_received)
1422 struct vdec_t *vdec = inst->priv;
1428 vdec->aborting = true;
1430 vdec->params.end_flag = 1;
1431 vpu_iface_set_decode_params(inst, &vdec->params, 1);
1442 vdec->params.frame_count,
1443 vdec->decoded_frame_count,
1444 vdec->display_frame_count,
1445 vdec->sequence);
1446 if (!vdec->seq_hdr_found)
1447 vdec->reset_codec = true;
1448 vdec->params.end_flag = 0;
1449 vdec->drain = 0;
1450 vdec->params.frame_count = 0;
1451 vdec->decoded_frame_count = 0;
1452 vdec->display_frame_count = 0;
1453 vdec->sequence = 0;
1454 vdec->aborting = false;
1460 struct vdec_t *vdec = inst->priv;
1465 vdec_clear_fs(&vdec->mbi);
1466 vdec_clear_fs(&vdec->dcp);
1468 vpu_free_dma(&vdec->udata);
1472 vdec->reset_codec = false;
1484 struct vdec_t *vdec;
1489 vdec = inst->priv;
1490 vfree(vdec);
1495 static void vdec_init_params(struct vdec_t *vdec)
1497 vdec->params.frame_count = 0;
1498 vdec->params.end_flag = 0;
1503 struct vdec_t *vdec = inst->priv;
1511 if (!vdec->udata.virt) {
1512 vdec->udata.length = 0x1000;
1513 ret = vpu_alloc_dma(inst->core, &vdec->udata);
1536 vdec->params.udata.base = vdec->udata.phys;
1537 vdec->params.udata.size = vdec->udata.length;
1538 ret = vpu_iface_set_decode_params(inst, &vdec->params, 0);
1544 vdec_init_params(vdec);
1555 vpu_free_dma(&vdec->udata);
1562 struct vdec_t *vdec = inst->priv;
1566 if (vdec->reset_codec)
1576 vdec_update_state(inst, vdec->state, 1);
1577 vdec->eos_received = 0;
1590 struct vdec_t *vdec = inst->priv;
1597 vdec->drain = 0;
1601 vdec->eos_received = 0;
1611 struct vdec_t *vdec = inst->priv;
1618 vdec->req_frame_count,
1619 vdec->codec_info.progressive ? 0 : 1);
1624 vdec->mbi.size,
1625 vdec->mbi.req_count,
1626 vdec->mbi.count,
1627 vdec->mbi.index);
1632 vdec->dcp.size,
1633 vdec->dcp.req_count,
1634 vdec->dcp.count,
1635 vdec->dcp.index);
1638 num = scnprintf(str, size, "input_frame_count = %d\n", vdec->params.frame_count);
1641 num = scnprintf(str, size, "decoded_frame_count = %d\n", vdec->decoded_frame_count);
1644 num = scnprintf(str, size, "display_frame_count = %d\n", vdec->display_frame_count);
1647 num = scnprintf(str, size, "sequence = %d\n", vdec->sequence);
1651 vdec->drain, vdec->eos_received, vdec->source_change);
1655 vdec->codec_info.frame_rate.numerator,
1656 vdec->codec_info.frame_rate.denominator);
1660 vdec->codec_info.color_primaries,
1661 vdec->codec_info.transfer_chars,
1662 vdec->codec_info.matrix_coeffs,
1663 vdec->codec_info.full_range,
1664 vdec->codec_info.vui_present);
1717 struct vdec_t *vdec;
1724 vdec = vzalloc(sizeof(*vdec));
1725 if (!vdec) {
1733 inst->priv = vdec;
1739 vdec->fixed_fmt = false;
1740 vdec->state = VPU_CODEC_STATE_ACTIVE;