diff --git a/src/Makefile.am b/src/Makefile.am index 011e57e..e4cc60d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,13 +20,13 @@ driver_libs = \ $(LIBVA_DEPS_LIBS) source_c = sunxi_cedrus.c object_heap.c buffer.c va_config.c \ - context.c image.c mpeg2.c mpeg4.c picture.c subpicture.c surface.c + context.c image.c mpeg2.c picture.c subpicture.c surface.c source_s = \ tiled_yuv.S source_h = sunxi_cedrus_drv_video.h object_heap.h buffer.h va_config.h \ - context.h image.h mpeg2.h mpeg4.h picture.h subpicture.h surface.h \ + context.h image.h mpeg2.h picture.h subpicture.h surface.h \ tiled_yuv.h sunxi_cedrus_drv_video_la_LTLIBRARIES = sunxi_cedrus_drv_video.la diff --git a/src/context.c b/src/context.c index 1fdeb58..be04fe9 100644 --- a/src/context.c +++ b/src/context.c @@ -122,11 +122,6 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP ctx, VAConfigID config_id, case VAProfileMPEG2Main: fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG2_FRAME; break; - case VAProfileMPEG4Simple: - case VAProfileMPEG4AdvancedSimple: - case VAProfileMPEG4Main: - fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG4_FRAME; - break; default: vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE; return vaStatus; diff --git a/src/context.h b/src/context.h index f24006a..c9d49ff 100644 --- a/src/context.h +++ b/src/context.h @@ -52,7 +52,6 @@ struct object_context { uint32_t num_rendered_surfaces; struct v4l2_ctrl_mpeg2_frame_hdr mpeg2_frame_hdr; - struct v4l2_ctrl_mpeg4_frame_hdr mpeg4_frame_hdr; }; VAStatus SunxiCedrusCreateContext(VADriverContextP ctx, VAConfigID config_id, diff --git a/src/mpeg4.c b/src/mpeg4.c deleted file mode 100644 index b422811..0000000 --- a/src/mpeg4.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2016 Florent Revest, - * 2007 Intel Corporation. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "sunxi_cedrus.h" -#include "mpeg4.h" - -#include -#include - -#include -#include - -#include - -/* - * This file takes care of filling v4l2's frame API MPEG4 headers extended - * controls from VA's data structures. - */ - -VAStatus sunxi_cedrus_render_mpeg4_slice_data(VADriverContextP ctx, - struct object_context *obj_context, struct object_surface *obj_surface, - struct object_buffer *obj_buffer) -{ - struct sunxi_cedrus_driver_data *driver_data = - (struct sunxi_cedrus_driver_data *) ctx->pDriverData; - VAStatus vaStatus = VA_STATUS_SUCCESS; - struct v4l2_buffer buf; - struct v4l2_plane plane[1]; - - memset(plane, 0, sizeof(struct v4l2_plane)); - - /* Query */ - memset(&(buf), 0, sizeof(buf)); - buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; - buf.memory = V4L2_MEMORY_MMAP; - buf.index = obj_surface->input_buf_index; - buf.length = 1; - buf.m.planes = plane; - - assert(ioctl(driver_data->mem2mem_fd, VIDIOC_QUERYBUF, &buf)==0); - - /* Populate frame */ - char *src_buf = mmap(NULL, obj_buffer->size, - PROT_READ | PROT_WRITE, MAP_SHARED, - driver_data->mem2mem_fd, buf.m.planes[0].m.mem_offset); - assert(src_buf != MAP_FAILED); - memcpy(src_buf, obj_buffer->buffer_data, obj_buffer->size); - - return vaStatus; -} - -VAStatus sunxi_cedrus_render_mpeg4_picture_parameter(VADriverContextP ctx, - struct object_context *obj_context, struct object_surface *obj_surface, - struct object_buffer *obj_buffer) -{ - struct sunxi_cedrus_driver_data *driver_data = - (struct sunxi_cedrus_driver_data *) ctx->pDriverData; - VAStatus vaStatus = VA_STATUS_SUCCESS; - - VAPictureParameterBufferMPEG4 *pic_param = (VAPictureParameterBufferMPEG4 *)obj_buffer->buffer_data; - - obj_context->mpeg4_frame_hdr.width = pic_param->vop_width; - obj_context->mpeg4_frame_hdr.height = pic_param->vop_height; - - obj_context->mpeg4_frame_hdr.vol_fields.short_video_header = pic_param->vol_fields.bits.short_video_header; - obj_context->mpeg4_frame_hdr.vol_fields.chroma_format = pic_param->vol_fields.bits.chroma_format; - obj_context->mpeg4_frame_hdr.vol_fields.interlaced = pic_param->vol_fields.bits.interlaced; - obj_context->mpeg4_frame_hdr.vol_fields.obmc_disable = pic_param->vol_fields.bits.obmc_disable; - obj_context->mpeg4_frame_hdr.vol_fields.sprite_enable = pic_param->vol_fields.bits.sprite_enable; - obj_context->mpeg4_frame_hdr.vol_fields.sprite_warping_accuracy = pic_param->vol_fields.bits.sprite_warping_accuracy; - obj_context->mpeg4_frame_hdr.vol_fields.quant_type = pic_param->vol_fields.bits.quant_type; - obj_context->mpeg4_frame_hdr.vol_fields.quarter_sample = pic_param->vol_fields.bits.quarter_sample; - obj_context->mpeg4_frame_hdr.vol_fields.data_partitioned = pic_param->vol_fields.bits.data_partitioned; - obj_context->mpeg4_frame_hdr.vol_fields.reversible_vlc = pic_param->vol_fields.bits.reversible_vlc; - obj_context->mpeg4_frame_hdr.vol_fields.resync_marker_disable = pic_param->vol_fields.bits.resync_marker_disable; - - obj_context->mpeg4_frame_hdr.vop_fields.vop_coding_type = pic_param->vop_fields.bits.vop_coding_type; - obj_context->mpeg4_frame_hdr.vop_fields.backward_reference_vop_coding_type = pic_param->vop_fields.bits.backward_reference_vop_coding_type; - obj_context->mpeg4_frame_hdr.vop_fields.vop_rounding_type = pic_param->vop_fields.bits.vop_rounding_type; - obj_context->mpeg4_frame_hdr.vop_fields.intra_dc_vlc_thr = pic_param->vop_fields.bits.intra_dc_vlc_thr; - obj_context->mpeg4_frame_hdr.vop_fields.top_field_first = pic_param->vop_fields.bits.top_field_first; - obj_context->mpeg4_frame_hdr.vop_fields.alternate_vertical_scan_flag = pic_param->vop_fields.bits.alternate_vertical_scan_flag; - - obj_context->mpeg4_frame_hdr.vop_fcode_forward = pic_param->vop_fcode_forward; - obj_context->mpeg4_frame_hdr.vop_fcode_backward = pic_param->vop_fcode_backward; - - obj_context->mpeg4_frame_hdr.trb = pic_param->TRB; - obj_context->mpeg4_frame_hdr.trd = pic_param->TRD; - - struct object_surface *fwd_surface = SURFACE(pic_param->forward_reference_picture); - if(fwd_surface) - obj_context->mpeg4_frame_hdr.forward_index = fwd_surface->output_buf_index; - else - obj_context->mpeg4_frame_hdr.forward_index = obj_surface->output_buf_index; - struct object_surface *bwd_surface = SURFACE(pic_param->backward_reference_picture); - if(bwd_surface) - obj_context->mpeg4_frame_hdr.backward_index = bwd_surface->output_buf_index; - else - obj_context->mpeg4_frame_hdr.backward_index = obj_surface->output_buf_index; - - return vaStatus; -} - -VAStatus sunxi_cedrus_render_mpeg4_slice_parameter(VADriverContextP ctx, - struct object_context *obj_context, struct object_surface *obj_surface, - struct object_buffer *obj_buffer) -{ - VASliceParameterBufferMPEG4 *slice_param = (VASliceParameterBufferMPEG4 *)obj_buffer->buffer_data; - - obj_context->mpeg4_frame_hdr.slice_pos = slice_param->slice_data_offset*8+slice_param->macroblock_offset; - obj_context->mpeg4_frame_hdr.slice_len = slice_param->slice_data_size*8; - obj_context->mpeg4_frame_hdr.quant_scale = slice_param->quant_scale; - - return VA_STATUS_SUCCESS; -} - diff --git a/src/mpeg4.h b/src/mpeg4.h deleted file mode 100644 index 2a64d29..0000000 --- a/src/mpeg4.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016 Florent Revest, - * 2007 Intel Corporation. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef _MPEG4_H_ -#define _MPEG4_H_ - -#include - -#include "context.h" -#include "buffer.h" - -#include "surface.h" - -VAStatus sunxi_cedrus_render_mpeg4_slice_data(VADriverContextP ctx, - struct object_context *obj_context, struct object_surface *obj_surface, - struct object_buffer *obj_buffer); - -VAStatus sunxi_cedrus_render_mpeg4_picture_parameter(VADriverContextP ctx, - struct object_context *obj_context, struct object_surface *obj_surface, - struct object_buffer *obj_buffer); - -VAStatus sunxi_cedrus_render_mpeg4_slice_parameter(VADriverContextP ctx, - struct object_context *obj_context, struct object_surface *obj_surface, - struct object_buffer *obj_buffer); - -#endif /* _MPEG4_H_ */ diff --git a/src/picture.c b/src/picture.c index d49231e..d0e2e5e 100644 --- a/src/picture.c +++ b/src/picture.c @@ -31,7 +31,6 @@ #include "va_config.h" #include "mpeg2.h" -#include "mpeg4.h" #include #include @@ -124,16 +123,6 @@ VAStatus SunxiCedrusRenderPicture(VADriverContextP ctx, VAContextID context, else if(obj_buffer->type == VAPictureParameterBufferType) vaStatus = sunxi_cedrus_render_mpeg2_picture_parameter(ctx, obj_context, obj_surface, obj_buffer); break; - case VAProfileMPEG4Simple: - case VAProfileMPEG4AdvancedSimple: - case VAProfileMPEG4Main: - if(obj_buffer->type == VASliceDataBufferType) - vaStatus = sunxi_cedrus_render_mpeg4_slice_data(ctx, obj_context, obj_surface, obj_buffer); - else if(obj_buffer->type == VAPictureParameterBufferType) - vaStatus = sunxi_cedrus_render_mpeg4_picture_parameter(ctx, obj_context, obj_surface, obj_buffer); - else if(obj_buffer->type == VASliceParameterBufferType) - vaStatus = sunxi_cedrus_render_mpeg4_slice_parameter(ctx, obj_context, obj_surface, obj_buffer); - break; default: break; } @@ -208,14 +197,6 @@ VAStatus SunxiCedrusEndPicture(VADriverContextP ctx, VAContextID context) ctrl.ptr = &obj_context->mpeg2_frame_hdr; ctrl.size = sizeof(obj_context->mpeg2_frame_hdr); break; - case VAProfileMPEG4Simple: - case VAProfileMPEG4AdvancedSimple: - case VAProfileMPEG4Main: - out_buf.m.planes[0].bytesused = obj_context->mpeg4_frame_hdr.slice_len/8; - ctrl.id = V4L2_CID_MPEG_VIDEO_MPEG4_FRAME_HDR; - ctrl.ptr = &obj_context->mpeg4_frame_hdr; - ctrl.size = sizeof(obj_context->mpeg4_frame_hdr); - break; default: out_buf.m.planes[0].bytesused = 0; ctrl.id = V4L2_CID_MPEG_VIDEO_MPEG2_FRAME_HDR; diff --git a/src/va_config.c b/src/va_config.c index dc7ff99..50a839b 100644 --- a/src/va_config.c +++ b/src/va_config.c @@ -57,11 +57,6 @@ VAStatus SunxiCedrusQueryConfigProfiles(VADriverContextP ctx, profile_list[i++] = VAProfileMPEG2Simple; profile_list[i++] = VAProfileMPEG2Main; break; - case V4L2_PIX_FMT_MPEG4_FRAME: - profile_list[i++] = VAProfileMPEG4Simple; - profile_list[i++] = VAProfileMPEG4AdvancedSimple; - profile_list[i++] = VAProfileMPEG4Main; - break; } vid_fmtdesc.index++; } @@ -84,13 +79,6 @@ VAStatus SunxiCedrusQueryConfigEntrypoints(VADriverContextP ctx, entrypoint_list[1] = VAEntrypointMoComp; break; - case VAProfileMPEG4Simple: - case VAProfileMPEG4AdvancedSimple: - case VAProfileMPEG4Main: - *num_entrypoints = 1; - entrypoint_list[0] = VAEntrypointVLD; - break; - default: *num_entrypoints = 0; break; @@ -171,15 +159,6 @@ VAStatus SunxiCedrusCreateConfig(VADriverContextP ctx, VAProfile profile, vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT; break; - case VAProfileMPEG4Simple: - case VAProfileMPEG4AdvancedSimple: - case VAProfileMPEG4Main: - if (VAEntrypointVLD == entrypoint) - vaStatus = VA_STATUS_SUCCESS; - else - vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT; - break; - default: vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE; break;