1 /* /////////////////////////////////////////////////////////////////////// 2 // 3 // INTEL CORPORATION PROPRIETARY INFORMATION 4 // This software is supplied under the terms of a license agreement or 5 // nondisclosure agreement with Intel Corporation and may not be copied 6 // or disclosed except in accordance with the terms of that agreement. 7 // Copyright (c) 2008 Intel Corporation. All Rights Reserved. 8 // 9 // Description: Parses VC-1 syntax elements MVRANGE and DMVRANGE. 10 // 11 */ 12 13 #include "vc1parse.h" 14 15 /*------------------------------------------------------------------------------ 16 * Parse syntax element MVRANGE, which exists for main and advanced profiles. 17 *------------------------------------------------------------------------------ 18 */ 19 20 vc1_Status vc1_MVRangeDecode(void* ctxt, vc1_Info *pInfo) 21 { 22 vc1_Status status = VC1_STATUS_OK; 23 vc1_metadata_t *md = &pInfo->metadata; 24 vc1_PictureLayerHeader *picLayerHeader = &pInfo->picLayerHeader; 25 26 if (md->EXTENDED_MV == 1) 27 { 28 VC1_GET_BITS9(1, picLayerHeader->MVRANGE); 29 if (picLayerHeader->MVRANGE) 30 { 31 VC1_GET_BITS9(1, picLayerHeader->MVRANGE); 32 if (picLayerHeader->MVRANGE) 33 { 34 VC1_GET_BITS9(1, picLayerHeader->MVRANGE); 35 picLayerHeader->MVRANGE += 1; 36 } 37 picLayerHeader->MVRANGE += 1; 38 } 39 } 40 else 41 picLayerHeader->MVRANGE = 0; 42 43 return status; 44 } 45 46 /*------------------------------------------------------------------------------ 47 * Parse syntax element DMVRANGE. 48 *------------------------------------------------------------------------------ 49 */ 50 51 vc1_Status vc1_DMVRangeDecode(void* ctxt, vc1_Info *pInfo) 52 { 53 vc1_Status status = VC1_STATUS_OK; 54 vc1_metadata_t *md = &pInfo->metadata; 55 vc1_PictureLayerHeader *picLayerHeader = &pInfo->picLayerHeader; 56 57 if (md->EXTENDED_DMV == 1) 58 { 59 VC1_GET_BITS9(1, picLayerHeader->DMVRANGE); 60 if (picLayerHeader->DMVRANGE == 0) 61 picLayerHeader->DMVRANGE = VC1_DMVRANGE_NONE; 62 else 63 { 64 VC1_GET_BITS9(1, picLayerHeader->DMVRANGE); 65 if (picLayerHeader->DMVRANGE == 0) 66 picLayerHeader->DMVRANGE = VC1_DMVRANGE_HORIZONTAL_RANGE; 67 else 68 { 69 VC1_GET_BITS9(1, picLayerHeader->DMVRANGE); 70 if (picLayerHeader->DMVRANGE == 0) 71 picLayerHeader->DMVRANGE = VC1_DMVRANGE_VERTICAL_RANGE; 72 else 73 { 74 picLayerHeader->DMVRANGE = 75 VC1_DMVRANGE_HORIZONTAL_VERTICAL_RANGE; 76 } 77 } 78 } 79 } 80 81 return status; 82 } 83