10c1bc742181ded4930842b46e9507372f0b1b963James Dong/* ---------------------------------------------------------------- 20c1bc742181ded4930842b46e9507372f0b1b963James Dong * 30c1bc742181ded4930842b46e9507372f0b1b963James Dong * 40c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name: armVCM4P10_UnpackBlock4x4.c 50c1bc742181ded4930842b46e9507372f0b1b963James Dong * OpenMAX DL: v1.0.2 60c1bc742181ded4930842b46e9507372f0b1b963James Dong * Revision: 9641 70c1bc742181ded4930842b46e9507372f0b1b963James Dong * Date: Thursday, February 7, 2008 80c1bc742181ded4930842b46e9507372f0b1b963James Dong * 90c1bc742181ded4930842b46e9507372f0b1b963James Dong * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 100c1bc742181ded4930842b46e9507372f0b1b963James Dong * 110c1bc742181ded4930842b46e9507372f0b1b963James Dong * 120c1bc742181ded4930842b46e9507372f0b1b963James Dong * 130c1bc742181ded4930842b46e9507372f0b1b963James Dong * H.264 inverse quantize and transform helper module 140c1bc742181ded4930842b46e9507372f0b1b963James Dong * 150c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 160c1bc742181ded4930842b46e9507372f0b1b963James Dong 170c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h" 180c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h" 190c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxVC.h" 200c1bc742181ded4930842b46e9507372f0b1b963James Dong 210c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h" 220c1bc742181ded4930842b46e9507372f0b1b963James Dong 230c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description 250c1bc742181ded4930842b46e9507372f0b1b963James Dong * Unpack a 4x4 block of coefficient-residual pair values 260c1bc742181ded4930842b46e9507372f0b1b963James Dong * 270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters: 280c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] ppSrc Double pointer to residual coefficient-position pair 290c1bc742181ded4930842b46e9507372f0b1b963James Dong * buffer output by CALVC decoding 300c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] ppSrc *ppSrc is updated to the start of next non empty block 310c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pDst Pointer to unpacked 4x4 block 320c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 330c1bc742181ded4930842b46e9507372f0b1b963James Dong 340c1bc742181ded4930842b46e9507372f0b1b963James Dongvoid armVCM4P10_UnpackBlock4x4( 350c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8 **ppSrc, 360c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16* pDst 370c1bc742181ded4930842b46e9507372f0b1b963James Dong) 380c1bc742181ded4930842b46e9507372f0b1b963James Dong{ 390c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8 *pSrc = *ppSrc; 400c1bc742181ded4930842b46e9507372f0b1b963James Dong int i; 410c1bc742181ded4930842b46e9507372f0b1b963James Dong int Flag, Value; 420c1bc742181ded4930842b46e9507372f0b1b963James Dong 430c1bc742181ded4930842b46e9507372f0b1b963James Dong for (i=0; i<16; i++) 440c1bc742181ded4930842b46e9507372f0b1b963James Dong { 450c1bc742181ded4930842b46e9507372f0b1b963James Dong pDst[i] = 0; 460c1bc742181ded4930842b46e9507372f0b1b963James Dong } 470c1bc742181ded4930842b46e9507372f0b1b963James Dong 480c1bc742181ded4930842b46e9507372f0b1b963James Dong do 490c1bc742181ded4930842b46e9507372f0b1b963James Dong { 500c1bc742181ded4930842b46e9507372f0b1b963James Dong Flag = *pSrc++; 510c1bc742181ded4930842b46e9507372f0b1b963James Dong if (Flag & 0x10) 520c1bc742181ded4930842b46e9507372f0b1b963James Dong { 530c1bc742181ded4930842b46e9507372f0b1b963James Dong /* 16 bit */ 540c1bc742181ded4930842b46e9507372f0b1b963James Dong Value = *pSrc++; 550c1bc742181ded4930842b46e9507372f0b1b963James Dong Value = Value | ((*pSrc++)<<8); 560c1bc742181ded4930842b46e9507372f0b1b963James Dong if (Value & 0x8000) 570c1bc742181ded4930842b46e9507372f0b1b963James Dong { 580c1bc742181ded4930842b46e9507372f0b1b963James Dong Value -= 0x10000; 590c1bc742181ded4930842b46e9507372f0b1b963James Dong } 600c1bc742181ded4930842b46e9507372f0b1b963James Dong } 610c1bc742181ded4930842b46e9507372f0b1b963James Dong else 620c1bc742181ded4930842b46e9507372f0b1b963James Dong { 630c1bc742181ded4930842b46e9507372f0b1b963James Dong /* 8 bit */ 640c1bc742181ded4930842b46e9507372f0b1b963James Dong Value = *pSrc++; 650c1bc742181ded4930842b46e9507372f0b1b963James Dong if (Value & 0x80) 660c1bc742181ded4930842b46e9507372f0b1b963James Dong { 670c1bc742181ded4930842b46e9507372f0b1b963James Dong Value -= 0x100; 680c1bc742181ded4930842b46e9507372f0b1b963James Dong } 690c1bc742181ded4930842b46e9507372f0b1b963James Dong } 700c1bc742181ded4930842b46e9507372f0b1b963James Dong i = Flag & 15; 710c1bc742181ded4930842b46e9507372f0b1b963James Dong pDst[i] = (OMX_S16)Value; 720c1bc742181ded4930842b46e9507372f0b1b963James Dong } 730c1bc742181ded4930842b46e9507372f0b1b963James Dong while ((Flag & 0x20)==0); 740c1bc742181ded4930842b46e9507372f0b1b963James Dong 750c1bc742181ded4930842b46e9507372f0b1b963James Dong *ppSrc = pSrc; 760c1bc742181ded4930842b46e9507372f0b1b963James Dong} 770c1bc742181ded4930842b46e9507372f0b1b963James Dong 780c1bc742181ded4930842b46e9507372f0b1b963James Dong/* End of file */ 79