videoeditorengine/avcedit/src/motcomp.cpp
changeset 0 951a5db380a0
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Ixonos Plc
       
    14 *
       
    15 * Description:
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifdef CHECK_MV_RANGE
       
    21 #include <stdio.h>
       
    22 #endif
       
    23 
       
    24 #include "globals.h"
       
    25 #include "motcomp.h"
       
    26 #include "framebuffer.h"
       
    27 
       
    28 #if defined(USE_CLIPBUF) && !defined(AVC_MOTION_COMP_ASM)
       
    29 #include "clipbuf.h"
       
    30 #endif
       
    31 
       
    32 
       
    33 #define ONEFOURTH1  20
       
    34 #define ONEFOURTH2  -5
       
    35 #define ONEFOURTH3  1
       
    36 
       
    37 
       
    38 static const int numModeMotVecs[MOT_NUM_MODES+1] = {
       
    39   0, 1, 2, 2, 4, 8, 8, 16
       
    40 };
       
    41 
       
    42 static const int numModeMotVecs8x8[4] = {
       
    43   1, 2, 2, 4
       
    44 };
       
    45 
       
    46 /*
       
    47 static const int blockShapes[][2] = {
       
    48   {4, 4},
       
    49   {4, 2},
       
    50   {2, 4},
       
    51   {2, 2}
       
    52 };
       
    53 
       
    54 static const int blockShapes8x8[][2] = {
       
    55   {2, 2},
       
    56   {2, 1},
       
    57   {1, 2},
       
    58   {1, 1}
       
    59 };
       
    60 */
       
    61 
       
    62 
       
    63 #ifdef CHECK_MV_RANGE
       
    64 extern int maxVerticalMvRange;
       
    65 #endif
       
    66 
       
    67 
       
    68 /*
       
    69  *
       
    70  * mcpGetNumMotVecs:
       
    71  *
       
    72  * Parameters:
       
    73  *      mode                  MB partition type (16x16, 8x16, 16x8, 8x8)
       
    74  *      subMbTypes            Sub-MB partition types (8x8, 4x8, 8x4, 4x4)
       
    75  *
       
    76  * Function:
       
    77  *      Get the number of motion vectors that need to be decoded for given
       
    78  *      MB type and Sub-MB partition types.
       
    79  *      
       
    80  * Returns:
       
    81  *      Number of motion vectors.
       
    82  *
       
    83  */
       
    84 int mcpGetNumMotVecs(int interMode, int subMbTypes[4])
       
    85 {
       
    86   int numVecs;
       
    87 
       
    88   if (interMode < MOT_8x8)
       
    89     numVecs = numModeMotVecs[interMode];
       
    90   else {
       
    91     numVecs  = numModeMotVecs8x8[subMbTypes[0]];
       
    92     numVecs += numModeMotVecs8x8[subMbTypes[1]];
       
    93     numVecs += numModeMotVecs8x8[subMbTypes[2]];
       
    94     numVecs += numModeMotVecs8x8[subMbTypes[3]];
       
    95   }
       
    96 
       
    97   return numVecs;
       
    98 }
       
    99 
       
   100