st/va: move VC-1 functions into separate file
authorChristian König <christian.koenig@amd.com>
Mon, 23 Nov 2015 13:32:27 +0000 (14:32 +0100)
committerChristian König <christian.koenig@amd.com>
Tue, 24 Nov 2015 14:31:41 +0000 (15:31 +0100)
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
src/gallium/state_trackers/va/Makefile.sources
src/gallium/state_trackers/va/picture.c
src/gallium/state_trackers/va/picture_vc1.c [new file with mode: 0644]
src/gallium/state_trackers/va/va_private.h

index 77663a10422374bc640806394c21f6c3ae10a27d..4e42d5a2a5e50aaaf004426f9611170a07ea6410 100644 (file)
@@ -7,6 +7,7 @@ C_SOURCES := \
        picture.c \
        picture_mpeg12.c \
        picture_h264.c \
+       picture_vc1.c \
        postproc.c \
        subpicture.c \
        surface.c \
index 46ca5e8d57bd1ae20c42289432f8861d2ef24846..24f26edea5643a8c7de91e70a446864c082cfc42 100644 (file)
@@ -89,7 +89,6 @@ vlVaGetReferenceFrame(vlVaDriver *drv, VASurfaceID surface_id,
 static void
 handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
 {
-   VAPictureParameterBufferVC1 * vc1;
    VAPictureParameterBufferMPEG4 *mpeg4;
    VAPictureParameterBufferHEVC *hevc;
    vlVaSurface *surf_forward;
@@ -108,40 +107,7 @@ handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *
       break;
 
    case PIPE_VIDEO_FORMAT_VC1:
-      assert(buf->size >= sizeof(VAPictureParameterBufferVC1) && buf->num_elements == 1);
-      vc1 = buf->data;
-      vlVaGetReferenceFrame(drv, vc1->forward_reference_picture, &context->desc.vc1.ref[0]);
-      vlVaGetReferenceFrame(drv, vc1->backward_reference_picture, &context->desc.vc1.ref[1]);
-      context->desc.vc1.picture_type = vc1->picture_fields.bits.picture_type;
-      context->desc.vc1.frame_coding_mode = vc1->picture_fields.bits.frame_coding_mode;
-      context->desc.vc1.postprocflag = vc1->post_processing != 0;
-      context->desc.vc1.pulldown = vc1->sequence_fields.bits.pulldown;
-      context->desc.vc1.interlace = vc1->sequence_fields.bits.interlace;
-      context->desc.vc1.tfcntrflag = vc1->sequence_fields.bits.tfcntrflag;
-      context->desc.vc1.finterpflag = vc1->sequence_fields.bits.finterpflag;
-      context->desc.vc1.psf = vc1->sequence_fields.bits.psf;
-      context->desc.vc1.dquant = vc1->pic_quantizer_fields.bits.dquant;
-      context->desc.vc1.panscan_flag = vc1->entrypoint_fields.bits.panscan_flag;
-      context->desc.vc1.refdist_flag =
-         vc1->reference_fields.bits.reference_distance_flag;
-      context->desc.vc1.quantizer = vc1->pic_quantizer_fields.bits.quantizer;
-      context->desc.vc1.extended_mv = vc1->mv_fields.bits.extended_mv_flag;
-      context->desc.vc1.extended_dmv = vc1->mv_fields.bits.extended_dmv_flag;
-      context->desc.vc1.overlap = vc1->sequence_fields.bits.overlap;
-      context->desc.vc1.vstransform =
-         vc1->transform_fields.bits.variable_sized_transform_flag;
-      context->desc.vc1.loopfilter = vc1->entrypoint_fields.bits.loopfilter;
-      context->desc.vc1.fastuvmc = vc1->fast_uvmc_flag;
-      context->desc.vc1.range_mapy_flag = vc1->range_mapping_fields.bits.luma_flag;
-      context->desc.vc1.range_mapy = vc1->range_mapping_fields.bits.luma;
-      context->desc.vc1.range_mapuv_flag = vc1->range_mapping_fields.bits.chroma_flag;
-      context->desc.vc1.range_mapuv = vc1->range_mapping_fields.bits.chroma;
-      context->desc.vc1.multires = vc1->sequence_fields.bits.multires;
-      context->desc.vc1.syncmarker = vc1->sequence_fields.bits.syncmarker;
-      context->desc.vc1.rangered = vc1->sequence_fields.bits.rangered;
-      context->desc.vc1.maxbframes = vc1->sequence_fields.bits.max_b_frames;
-      context->desc.vc1.deblockEnable = vc1->post_processing != 0;
-      context->desc.vc1.pquant = vc1->pic_quantizer_fields.bits.pic_quantizer_scale;
+      vlVaHandlePictureParameterBufferVC1(drv, context, buf);
       break;
 
    case PIPE_VIDEO_FORMAT_MPEG4:
diff --git a/src/gallium/state_trackers/va/picture_vc1.c b/src/gallium/state_trackers/va/picture_vc1.c
new file mode 100644 (file)
index 0000000..f95fd83
--- /dev/null
@@ -0,0 +1,67 @@
+/**************************************************************************
+ *
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ * 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 THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "va_private.h"
+
+void vlVaHandlePictureParameterBufferVC1(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
+{
+   VAPictureParameterBufferVC1 * vc1 = buf->data;
+
+   assert(buf->size >= sizeof(VAPictureParameterBufferVC1) && buf->num_elements == 1);
+   vlVaGetReferenceFrame(drv, vc1->forward_reference_picture, &context->desc.vc1.ref[0]);
+   vlVaGetReferenceFrame(drv, vc1->backward_reference_picture, &context->desc.vc1.ref[1]);
+   context->desc.vc1.picture_type = vc1->picture_fields.bits.picture_type;
+   context->desc.vc1.frame_coding_mode = vc1->picture_fields.bits.frame_coding_mode;
+   context->desc.vc1.postprocflag = vc1->post_processing != 0;
+   context->desc.vc1.pulldown = vc1->sequence_fields.bits.pulldown;
+   context->desc.vc1.interlace = vc1->sequence_fields.bits.interlace;
+   context->desc.vc1.tfcntrflag = vc1->sequence_fields.bits.tfcntrflag;
+   context->desc.vc1.finterpflag = vc1->sequence_fields.bits.finterpflag;
+   context->desc.vc1.psf = vc1->sequence_fields.bits.psf;
+   context->desc.vc1.dquant = vc1->pic_quantizer_fields.bits.dquant;
+   context->desc.vc1.panscan_flag = vc1->entrypoint_fields.bits.panscan_flag;
+   context->desc.vc1.refdist_flag =
+      vc1->reference_fields.bits.reference_distance_flag;
+   context->desc.vc1.quantizer = vc1->pic_quantizer_fields.bits.quantizer;
+   context->desc.vc1.extended_mv = vc1->mv_fields.bits.extended_mv_flag;
+   context->desc.vc1.extended_dmv = vc1->mv_fields.bits.extended_dmv_flag;
+   context->desc.vc1.overlap = vc1->sequence_fields.bits.overlap;
+   context->desc.vc1.vstransform =
+      vc1->transform_fields.bits.variable_sized_transform_flag;
+   context->desc.vc1.loopfilter = vc1->entrypoint_fields.bits.loopfilter;
+   context->desc.vc1.fastuvmc = vc1->fast_uvmc_flag;
+   context->desc.vc1.range_mapy_flag = vc1->range_mapping_fields.bits.luma_flag;
+   context->desc.vc1.range_mapy = vc1->range_mapping_fields.bits.luma;
+   context->desc.vc1.range_mapuv_flag = vc1->range_mapping_fields.bits.chroma_flag;
+   context->desc.vc1.range_mapuv = vc1->range_mapping_fields.bits.chroma;
+   context->desc.vc1.multires = vc1->sequence_fields.bits.multires;
+   context->desc.vc1.syncmarker = vc1->sequence_fields.bits.syncmarker;
+   context->desc.vc1.rangered = vc1->sequence_fields.bits.rangered;
+   context->desc.vc1.maxbframes = vc1->sequence_fields.bits.max_b_frames;
+   context->desc.vc1.deblockEnable = vc1->post_processing != 0;
+   context->desc.vc1.pquant = vc1->pic_quantizer_fields.bits.pic_quantizer_scale;
+}
index aa72410ff5a962c54d8af8f40be303b839159b54..8ada8c30196e2112dc28efa9cee4ef1640829332 100644 (file)
@@ -349,5 +349,6 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf);
 void vlVaHandlePictureParameterBufferH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);
 void vlVaHandleIQMatrixBufferH264(vlVaContext *context, vlVaBuffer *buf);
 void vlVaHandleSliceParameterBufferH264(vlVaContext *context, vlVaBuffer *buf);
+void vlVaHandlePictureParameterBufferVC1(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);
 
 #endif //VA_PRIVATE_H