1/**************************************************************************
2 *
3 * Copyright 2014 Advanced Micro Devices, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28#include "va_private.h"
29
30void vlVaHandlePictureParameterBufferVC1(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
31{
32   VAPictureParameterBufferVC1 * vc1 = buf->data;
33
34   assert(buf->size >= sizeof(VAPictureParameterBufferVC1) && buf->num_elements == 1);
35   context->desc.vc1.slice_count = 0;
36   vlVaGetReferenceFrame(drv, vc1->forward_reference_picture, &context->desc.vc1.ref[0]);
37   vlVaGetReferenceFrame(drv, vc1->backward_reference_picture, &context->desc.vc1.ref[1]);
38   context->desc.vc1.picture_type = vc1->picture_fields.bits.picture_type;
39   context->desc.vc1.frame_coding_mode = vc1->picture_fields.bits.frame_coding_mode;
40   context->desc.vc1.postprocflag = vc1->post_processing != 0;
41   context->desc.vc1.pulldown = vc1->sequence_fields.bits.pulldown;
42   context->desc.vc1.interlace = vc1->sequence_fields.bits.interlace;
43   context->desc.vc1.tfcntrflag = vc1->sequence_fields.bits.tfcntrflag;
44   context->desc.vc1.finterpflag = vc1->sequence_fields.bits.finterpflag;
45   context->desc.vc1.psf = vc1->sequence_fields.bits.psf;
46   context->desc.vc1.dquant = vc1->pic_quantizer_fields.bits.dquant;
47   context->desc.vc1.panscan_flag = vc1->entrypoint_fields.bits.panscan_flag;
48   context->desc.vc1.refdist_flag =
49      vc1->reference_fields.bits.reference_distance_flag;
50   context->desc.vc1.quantizer = vc1->pic_quantizer_fields.bits.quantizer;
51   context->desc.vc1.extended_mv = vc1->mv_fields.bits.extended_mv_flag;
52   context->desc.vc1.extended_dmv = vc1->mv_fields.bits.extended_dmv_flag;
53   context->desc.vc1.overlap = vc1->sequence_fields.bits.overlap;
54   context->desc.vc1.vstransform =
55      vc1->transform_fields.bits.variable_sized_transform_flag;
56   context->desc.vc1.loopfilter = vc1->entrypoint_fields.bits.loopfilter;
57   context->desc.vc1.fastuvmc = vc1->fast_uvmc_flag;
58   context->desc.vc1.range_mapy_flag = vc1->range_mapping_fields.bits.luma_flag;
59   context->desc.vc1.range_mapy = vc1->range_mapping_fields.bits.luma;
60   context->desc.vc1.range_mapuv_flag = vc1->range_mapping_fields.bits.chroma_flag;
61   context->desc.vc1.range_mapuv = vc1->range_mapping_fields.bits.chroma;
62   context->desc.vc1.multires = vc1->sequence_fields.bits.multires;
63   context->desc.vc1.syncmarker = vc1->sequence_fields.bits.syncmarker;
64   context->desc.vc1.rangered = vc1->sequence_fields.bits.rangered;
65   context->desc.vc1.maxbframes = vc1->sequence_fields.bits.max_b_frames;
66   context->desc.vc1.deblockEnable = vc1->post_processing != 0;
67   context->desc.vc1.pquant = vc1->pic_quantizer_fields.bits.pic_quantizer_scale;
68}
69
70void vlVaHandleSliceParameterBufferVC1(vlVaContext *context, vlVaBuffer *buf)
71{
72   assert(buf->size >= sizeof(VASliceParameterBufferVC1) && buf->num_elements == 1);
73   context->desc.vc1.slice_count += buf->num_elements;
74}
75