• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
vlVaHandlePictureParameterBufferMPEG12(vlVaDriver * drv,vlVaContext * context,vlVaBuffer * buf)30 void vlVaHandlePictureParameterBufferMPEG12(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
31 {
32    VAPictureParameterBufferMPEG2 *mpeg2 = buf->data;
33 
34    assert(buf->size >= sizeof(VAPictureParameterBufferMPEG2) && buf->num_elements == 1);
35    context->desc.mpeg12.num_slices = 0;
36    /*horizontal_size;*/
37    /*vertical_size;*/
38    vlVaGetReferenceFrame(drv, mpeg2->forward_reference_picture, &context->desc.mpeg12.ref[0]);
39    vlVaGetReferenceFrame(drv, mpeg2->backward_reference_picture, &context->desc.mpeg12.ref[1]);
40    context->desc.mpeg12.picture_coding_type = mpeg2->picture_coding_type;
41    context->desc.mpeg12.f_code[0][0] = ((mpeg2->f_code >> 12) & 0xf) - 1;
42    context->desc.mpeg12.f_code[0][1] = ((mpeg2->f_code >> 8) & 0xf) - 1;
43    context->desc.mpeg12.f_code[1][0] = ((mpeg2->f_code >> 4) & 0xf) - 1;
44    context->desc.mpeg12.f_code[1][1] = (mpeg2->f_code & 0xf) - 1;
45    context->desc.mpeg12.intra_dc_precision =
46       mpeg2->picture_coding_extension.bits.intra_dc_precision;
47    context->desc.mpeg12.picture_structure =
48       mpeg2->picture_coding_extension.bits.picture_structure;
49    context->desc.mpeg12.top_field_first =
50       mpeg2->picture_coding_extension.bits.top_field_first;
51    context->desc.mpeg12.frame_pred_frame_dct =
52       mpeg2->picture_coding_extension.bits.frame_pred_frame_dct;
53    context->desc.mpeg12.concealment_motion_vectors =
54       mpeg2->picture_coding_extension.bits.concealment_motion_vectors;
55    context->desc.mpeg12.q_scale_type =
56       mpeg2->picture_coding_extension.bits.q_scale_type;
57    context->desc.mpeg12.intra_vlc_format =
58       mpeg2->picture_coding_extension.bits.intra_vlc_format;
59    context->desc.mpeg12.alternate_scan =
60       mpeg2->picture_coding_extension.bits.alternate_scan;
61    /*repeat_first_field*/
62    /*progressive_frame*/
63    /*is_first_field*/
64 }
65 
vlVaHandleIQMatrixBufferMPEG12(vlVaContext * context,vlVaBuffer * buf)66 void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, vlVaBuffer *buf)
67 {
68    VAIQMatrixBufferMPEG2 *mpeg2 = buf->data;
69 
70    assert(buf->size >= sizeof(VAIQMatrixBufferMPEG2) && buf->num_elements == 1);
71    if (mpeg2->load_intra_quantiser_matrix)
72       context->desc.mpeg12.intra_matrix = mpeg2->intra_quantiser_matrix;
73    else
74       context->desc.mpeg12.intra_matrix = NULL;
75 
76    if (mpeg2->load_non_intra_quantiser_matrix)
77       context->desc.mpeg12.non_intra_matrix = mpeg2->non_intra_quantiser_matrix;
78    else
79       context->desc.mpeg12.non_intra_matrix = NULL;
80 }
81 
vlVaHandleSliceParameterBufferMPEG12(vlVaContext * context,vlVaBuffer * buf)82 void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer *buf)
83 {
84    assert(buf->size >= sizeof(VASliceParameterBufferMPEG2));
85    context->desc.mpeg12.num_slices += buf->num_elements;
86 }
87