res = vpu_get_resource(inst); if (!res) return width; if (res->max_width)
width = clamp(width, res->min_width, res->max_width); if (res->step_width)
width = ALIGN(width, res->step_width);
res = vpu_get_resource(inst); if (!res) return height; if (res->max_height)
height = clamp(height, res->min_height, res->max_height); if (res->step_height)
height = ALIGN(height, res->step_height);
int vpu_helper_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
{ struct vpu_inst *inst = ctrl_to_inst(ctrl);
switch (ctrl->id) { case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
ctrl->val = inst->min_buffer_cap; break; case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT:
ctrl->val = inst->min_buffer_out; break; default: return -EINVAL;
}
return 0;
}
int vpu_helper_find_startcode(struct vpu_buffer *stream_buffer,
u32 pixelformat, u32 offset, u32 bytesused)
{
u32 start_code; int start_code_size;
u32 val = 0; int i; int ret = -EINVAL;
if (!stream_buffer || !stream_buffer->virt) return -EINVAL;
for (i = 0; i < bytesused; i++) {
val = (val << 8) | vpu_helper_read_byte(stream_buffer, offset + i); if (i < start_code_size - 1) continue; if (val == start_code) {
ret = i + 1 - start_code_size; break;
}
}
for (i = 0; i < cnt; i++) { if (pairs[i].dst == dst) return pairs[i].src;
}
return -EINVAL;
}
constchar *vpu_id_name(u32 id)
{ switch (id) { case VPU_CMD_ID_NOOP: return"noop"; case VPU_CMD_ID_CONFIGURE_CODEC: return"configure codec"; case VPU_CMD_ID_START: return"start"; case VPU_CMD_ID_STOP: return"stop"; case VPU_CMD_ID_ABORT: return"abort"; case VPU_CMD_ID_RST_BUF: return"reset buf"; case VPU_CMD_ID_SNAPSHOT: return"snapshot"; case VPU_CMD_ID_FIRM_RESET: return"reset firmware"; case VPU_CMD_ID_UPDATE_PARAMETER: return"update parameter"; case VPU_CMD_ID_FRAME_ENCODE: return"encode frame"; case VPU_CMD_ID_SKIP: return"skip"; case VPU_CMD_ID_FS_ALLOC: return"alloc fb"; case VPU_CMD_ID_FS_RELEASE: return"release fb"; case VPU_CMD_ID_TIMESTAMP: return"timestamp"; case VPU_CMD_ID_DEBUG: return"debug"; case VPU_MSG_ID_RESET_DONE: return"reset done"; case VPU_MSG_ID_START_DONE: return"start done"; case VPU_MSG_ID_STOP_DONE: return"stop done"; case VPU_MSG_ID_ABORT_DONE: return"abort done"; case VPU_MSG_ID_BUF_RST: return"buf reset done"; case VPU_MSG_ID_MEM_REQUEST: return"mem request"; case VPU_MSG_ID_PARAM_UPD_DONE: return"param upd done"; case VPU_MSG_ID_FRAME_INPUT_DONE: return"frame input done"; case VPU_MSG_ID_ENC_DONE: return"encode done"; case VPU_MSG_ID_DEC_DONE: return"frame display"; case VPU_MSG_ID_FRAME_REQ: return"fb request"; case VPU_MSG_ID_FRAME_RELEASE: return"fb release"; case VPU_MSG_ID_SEQ_HDR_FOUND: return"seq hdr found"; case VPU_MSG_ID_RES_CHANGE: return"resolution change"; case VPU_MSG_ID_PIC_HDR_FOUND: return"pic hdr found"; case VPU_MSG_ID_PIC_DECODED: return"picture decoded"; case VPU_MSG_ID_PIC_EOS: return"eos"; case VPU_MSG_ID_FIFO_LOW: return"fifo low"; case VPU_MSG_ID_BS_ERROR: return"bs error"; case VPU_MSG_ID_UNSUPPORTED: return"unsupported"; case VPU_MSG_ID_FIRMWARE_XCPT: return"exception"; case VPU_MSG_ID_PIC_SKIPPED: return"skipped"; case VPU_MSG_ID_DBG_MSG: return"debug msg";
} return"";
}
constchar *vpu_codec_state_name(enum vpu_codec_state state)
{ switch (state) { case VPU_CODEC_STATE_DEINIT: return"initialization"; case VPU_CODEC_STATE_CONFIGURED: return"configured"; case VPU_CODEC_STATE_START: return"start"; case VPU_CODEC_STATE_STARTED: return"started"; case VPU_CODEC_STATE_ACTIVE: return"active"; case VPU_CODEC_STATE_SEEK: return"seek"; case VPU_CODEC_STATE_STOP: return"stop"; case VPU_CODEC_STATE_DRAIN: return"drain"; case VPU_CODEC_STATE_DYAMIC_RESOLUTION_CHANGE: return"resolution change";
} return"";
}
for (i = 0; i < array_sz; i++) { if (id == array[i].id) return array[i].v4l2_id;
}
return 0;
}
u32 vpu_get_h264_v4l2_profile(struct vpu_dec_codec_info *hdr)
{ if (!hdr) return 0;
/* * In H.264 Document section A.2.1.1 Constrained Baseline profile * Conformance of a bitstream to the Constrained Baseline profile is indicated by * profile_idc being equal to 66 with constraint_set1_flag being equal to 1.
*/ if (hdr->profile_idc == 66 && hdr->constraint_set1_flag) return V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE;
u32 vpu_get_h264_v4l2_level(struct vpu_dec_codec_info *hdr)
{ if (!hdr) return 0;
/* * In H.264 Document section 7.4.2.1.1 Sequence parameter set data semantics * If profile_idc is equal to 66, 77, or 88 and level_idc is equal to 11, * constraint_set3_flag equal to 1 indicates that the coded video sequence * obeys all constraints specified in Annex A for level 1b * and constraint_set3_flag equal to 0 indicates that the coded video sequence * obeys all constraints specified in Annex A for level 1.1.
*/ if (hdr->level_idc == 11 && hdr->constraint_set3_flag &&
(hdr->profile_idc == 66 || hdr->profile_idc == 77 || hdr->profile_idc == 88)) return V4L2_MPEG_VIDEO_H264_LEVEL_1B;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.