Lines Matching defs:context

44    vlVaContext *context;
55 context = handle_table_get(drv->htab, context_id);
56 if (!context) {
61 if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_MPEG12) {
62 context->desc.mpeg12.intra_matrix = NULL;
63 context->desc.mpeg12.non_intra_matrix = NULL;
71 context->target_id = render_target;
73 context->target = surf->buffer;
74 context->mjpeg.sampling_factor = 0;
76 if (!context->decoder) {
79 if (context->templat.profile == PIPE_VIDEO_PROFILE_UNKNOWN &&
80 context->target->buffer_format != PIPE_FORMAT_B8G8R8A8_UNORM &&
81 context->target->buffer_format != PIPE_FORMAT_R8G8B8A8_UNORM &&
82 context->target->buffer_format != PIPE_FORMAT_B8G8R8X8_UNORM &&
83 context->target->buffer_format != PIPE_FORMAT_R8G8B8X8_UNORM &&
84 context->target->buffer_format != PIPE_FORMAT_NV12 &&
85 context->target->buffer_format != PIPE_FORMAT_P010 &&
86 context->target->buffer_format != PIPE_FORMAT_P016)
93 context->needs_begin_frame = true;
94 context->vpp_needs_flush_on_endpic = true;
100 if (context->decoder->entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE)
101 context->needs_begin_frame = true;
118 handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
122 u_reduce_video_profile(context->templat.profile);
126 vlVaHandlePictureParameterBufferMPEG12(drv, context, buf);
130 vlVaHandlePictureParameterBufferH264(drv, context, buf);
134 vlVaHandlePictureParameterBufferVC1(drv, context, buf);
138 vlVaHandlePictureParameterBufferMPEG4(drv, context, buf);
142 vlVaHandlePictureParameterBufferHEVC(drv, context, buf);
146 vlVaHandlePictureParameterBufferMJPEG(drv, context, buf);
150 vlVaHandlePictureParameterBufferVP9(drv, context, buf);
154 vlVaHandlePictureParameterBufferAV1(drv, context, buf);
162 if (!context->decoder) {
163 if (!context->target)
167 context->templat.level = u_get_h264_level(context->templat.width,
168 context->templat.height, &context->templat.max_references);
170 context->decoder = drv->pipe->create_video_codec(drv->pipe,
171 &context->templat);
173 if (!context->decoder)
176 context->needs_begin_frame = true;
180 context->decoder->width =
181 context->desc.vp9.picture_parameter.frame_width;
182 context->decoder->height =
183 context->desc.vp9.picture_parameter.frame_height;
190 handleIQMatrixBuffer(vlVaContext *context, vlVaBuffer *buf)
192 switch (u_reduce_video_profile(context->templat.profile)) {
194 vlVaHandleIQMatrixBufferMPEG12(context, buf);
198 vlVaHandleIQMatrixBufferH264(context, buf);
202 vlVaHandleIQMatrixBufferMPEG4(context, buf);
206 vlVaHandleIQMatrixBufferHEVC(context, buf);
210 vlVaHandleIQMatrixBufferMJPEG(context, buf);
219 handleSliceParameterBuffer(vlVaContext *context, vlVaBuffer *buf, unsigned num)
221 switch (u_reduce_video_profile(context->templat.profile)) {
223 vlVaHandleSliceParameterBufferMPEG12(context, buf);
227 vlVaHandleSliceParameterBufferVC1(context, buf);
231 vlVaHandleSliceParameterBufferH264(context, buf);
235 vlVaHandleSliceParameterBufferMPEG4(context, buf);
239 vlVaHandleSliceParameterBufferHEVC(context, buf);
243 vlVaHandleSliceParameterBufferMJPEG(context, buf);
247 vlVaHandleSliceParameterBufferVP9(context, buf);
251 vlVaHandleSliceParameterBufferAV1(context, buf, num);
278 handleVAProtectedSliceDataBufferType(vlVaContext *context, vlVaBuffer *buf)
284 context->desc.base.decrypt_key = CALLOC(1, drm_key_size);
285 memcpy(context->desc.base.decrypt_key, encrypted_data, drm_key_size);
286 context->desc.base.protected_playback = true;
290 handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf)
292 enum pipe_video_format format = u_reduce_video_profile(context->templat.profile);
301 if (!context->decoder)
304 format = u_reduce_video_profile(context->templat.profile);
305 if (!context->desc.base.protected_playback) {
327 if (context->decoder->profile == PIPE_VIDEO_PROFILE_VC1_ADVANCED) {
336 vlVaDecoderFixMPEG4Startcode(context);
337 buffers[num_buffers] = (void *)context->mpeg4.start_code;
338 sizes[num_buffers++] = context->mpeg4.start_code_size;
341 vlVaGetJpegSliceHeader(context);
342 buffers[num_buffers] = (void *)context->mjpeg.slice_header;
343 sizes[num_buffers++] = context->mjpeg.slice_header_size;
346 if (false == context->desc.base.protected_playback)
347 vlVaDecoderVP9BitstreamHeader(context, buf);
365 if (context->needs_begin_frame) {
366 context->decoder->begin_frame(context->decoder, context->target,
367 &context->desc.base);
368 context->needs_begin_frame = false;
370 context->decoder->decode_bitstream(context->decoder, context->target, &context->desc.base,
376 handleVAEncMiscParameterTypeRateControl(vlVaContext *context, VAEncMiscParameterBuffer *misc)
380 switch (u_reduce_video_profile(context->templat.profile)) {
382 status = vlVaHandleVAEncMiscParameterTypeRateControlH264(context, misc);
386 status = vlVaHandleVAEncMiscParameterTypeRateControlHEVC(context, misc);
397 handleVAEncMiscParameterTypeFrameRate(vlVaContext *context, VAEncMiscParameterBuffer *misc)
401 switch (u_reduce_video_profile(context->templat.profile)) {
403 status = vlVaHandleVAEncMiscParameterTypeFrameRateH264(context, misc);
407 status = vlVaHandleVAEncMiscParameterTypeFrameRateHEVC(context, misc);
418 handleVAEncMiscParameterTypeTemporalLayer(vlVaContext *context, VAEncMiscParameterBuffer *misc)
422 switch (u_reduce_video_profile(context->templat.profile)) {
424 status = vlVaHandleVAEncMiscParameterTypeTemporalLayerH264(context, misc);
438 handleVAEncSequenceParameterBufferType(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
442 switch (u_reduce_video_profile(context->templat.profile)) {
444 status = vlVaHandleVAEncSequenceParameterBufferTypeH264(drv, context, buf);
448 status = vlVaHandleVAEncSequenceParameterBufferTypeHEVC(drv, context, buf);
459 handleVAEncMiscParameterBufferType(vlVaContext *context, vlVaBuffer *buf)
467 vaStatus = handleVAEncMiscParameterTypeRateControl(context, misc);
471 vaStatus = handleVAEncMiscParameterTypeFrameRate(context, misc);
475 vaStatus = handleVAEncMiscParameterTypeTemporalLayer(context, misc);
486 handleVAEncPictureParameterBufferType(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
490 switch (u_reduce_video_profile(context->templat.profile)) {
492 status = vlVaHandleVAEncPictureParameterBufferTypeH264(drv, context, buf);
496 status = vlVaHandleVAEncPictureParameterBufferTypeHEVC(drv, context, buf);
507 handleVAEncSliceParameterBufferType(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
511 switch (u_reduce_video_profile(context->templat.profile)) {
513 status = vlVaHandleVAEncSliceParameterBufferTypeH264(drv, context, buf);
517 status = vlVaHandleVAEncSliceParameterBufferTypeHEVC(drv, context, buf);
528 handleVAEncPackedHeaderParameterBufferType(vlVaContext *context, vlVaBuffer *buf)
532 switch (u_reduce_video_profile(context->templat.profile)) {
542 context->packed_header_type = param->type;
550 handleVAEncPackedHeaderDataBufferType(vlVaContext *context, vlVaBuffer *buf)
554 if (context->packed_header_type != VAEncPackedHeaderSequence)
557 switch (u_reduce_video_profile(context->templat.profile)) {
559 status = vlVaHandleVAEncPackedHeaderDataBufferTypeHEVC(context, buf);
573 vlVaContext *context;
587 context = handle_table_get(drv->htab, context_id);
588 if (!context) {
602 handleVAProtectedSliceDataBufferType(context, buf);
610 vaStatus = handlePictureParameterBuffer(drv, context, buf);
614 handleIQMatrixBuffer(context, buf);
618 handleSliceParameterBuffer(context, buf, slice_param_idx++);
622 vaStatus = handleVASliceDataBufferType(context, buf);
626 vaStatus = vlVaHandleVAProcPipelineParameterBufferType(drv, context, buf);
630 vaStatus = handleVAEncSequenceParameterBufferType(drv, context, buf);
634 vaStatus = handleVAEncMiscParameterBufferType(context, buf);
638 vaStatus = handleVAEncPictureParameterBufferType(drv, context, buf);
642 vaStatus = handleVAEncSliceParameterBufferType(drv, context, buf);
646 vlVaHandleHuffmanTableBufferType(context, buf);
650 handleVAEncPackedHeaderParameterBufferType(context, buf);
653 handleVAEncPackedHeaderDataBufferType(context, buf);
669 vlVaContext *context;
686 context = handle_table_get(drv->htab, context_id);
688 if (!context)
691 if (!context->decoder) {
692 if (context->templat.profile != PIPE_VIDEO_PROFILE_UNKNOWN)
700 surf = handle_table_get(drv->htab, context->target_id);
701 context->mpeg4.frame_num++;
703 screen = context->decoder->context->screen;
704 supported = screen->get_video_param(screen, context->decoder->profile,
705 context->decoder->entrypoint,
712 context->decoder->profile,
713 context->decoder->entrypoint,
718 format = screen->get_video_param(screen, context->decoder->profile,
719 context->decoder->entrypoint,
729 if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_JPEG &&
731 if (context->mjpeg.sampling_factor == 0x211111 ||
732 context->mjpeg.sampling_factor == 0x221212) {
735 } else if (context->mjpeg.sampling_factor != 0x221111) {
742 if ((bool)(surf->templat.bind & PIPE_BIND_PROTECTED) != context->desc.base.protected_playback) {
743 if (context->desc.base.protected_playback) {
751 if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_AV1 &&
753 if (context->desc.av1.picture_parameter.bit_depth_idx == 1) {
767 if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
786 context->target = surf->buffer;
789 if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
790 coded_buf = context->coded_buf;
791 if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_MPEG4_AVC) {
792 getEncParamPresetH264(context);
793 context->desc.h264enc.frame_num_cnt++;
794 } else if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_HEVC)
795 getEncParamPresetH265(context);
797 context->desc.base.input_format = surf->buffer->buffer_format;
798 context->desc.base.output_format = surf->encoder_format;
800 context->decoder->begin_frame(context->decoder, context->target, &context->desc.base);
801 context->decoder->encode_bitstream(context->decoder, context->target,
807 context->decoder->end_frame(context->decoder, context->target, &context->desc.base);
808 if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE &&
809 u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_MPEG4_AVC) {
810 int idr_period = context->desc.h264enc.gop_size / context->gop_coeff;
811 int p_remain_in_idr = idr_period - context->desc.h264enc.frame_num;
812 surf->frame_num_cnt = context->desc.h264enc.frame_num_cnt;
814 if (context->first_single_submitted) {
815 context->decoder->flush(context->decoder);
816 context->first_single_submitted = false;
820 if ((context->desc.h264enc.frame_num_cnt % 2) != 0) {
821 context->decoder->flush(context->decoder);
822 context->first_single_submitted = true;
825 context->first_single_submitted = false;
828 if (!context->desc.h264enc.not_referenced)
829 context->desc.h264enc.frame_num++;
830 } else if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE &&
831 u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_HEVC)
832 context->desc.h265enc.frame_num++;
833 else if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_PROCESSING &&
834 context->vpp_needs_flush_on_endpic) {
835 context->decoder->flush(context->decoder);
836 context->vpp_needs_flush_on_endpic = false;