videoeditorengine/avcedit/inc/biblin.h
author Mikael Laine <mikael.laine@ixonos.com>
Fri, 29 Jan 2010 14:08:33 +0200
changeset 0 951a5db380a0
permissions -rw-r--r--
Committing the Video Editor package under the Eclipse Public License
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     1
/*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Ixonos Plc.
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     3
* All rights reserved.
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     5
* under the terms of the "Eclipse Public License v1.0"
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     8
*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
     9
* Initial Contributors:
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    10
* Nokia Corporation - Initial contribution
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    11
*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    12
* Contributors:
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    13
* Ixonos Plc
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    14
*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    15
* Description:  
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    16
* Header file for Bit Buffer module.
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    17
*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    18
*/
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    19
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    20
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    21
#ifndef _BIBLIN_H_
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    22
#define _BIBLIN_H_
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    23
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    24
// @@ HARI AVC  Added the below 8 lines
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    25
// make sure they are in the proper location etc... 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    26
#if defined(__SYMBIAN32__)
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    27
#define __EPOC__
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    28
//#include "epoclib.h"
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    29
#else
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    30
#include <assert.h>
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    31
#include <string.h>
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    32
//#include <stdlib.h>
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    33
#endif
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    34
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    35
#include "nrctyp32.h"
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    36
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    37
/*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    38
 * Defines
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    39
 */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    40
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    41
/* Error codes */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    42
/* Obsolete error codes are not used anymore and are defined only to maintain
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    43
   backwards compatibility with older versions of the file. */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    44
#define ERR_BIB_STRUCT_ALLOC 1000      /* If a structure allocation failed */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    45
#define ERR_BIB_BUFFER_ALLOC 1001      /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    46
#define ERR_BIB_FILE_READ 1002         /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    47
#define ERR_BIB_NOT_ENOUGH_DATA 1003   /* If the number of bits requested from
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    48
                                          the buffer is greater than the number
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    49
                                          of bits available in the buffer */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    50
#define ERR_BIB_ALREADY_OPENED 1004    /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    51
#define ERR_BIB_FILE_OPEN 1005         /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    52
#define ERR_BIB_ALREADY_CLOSED 1006    /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    53
#define ERR_BIB_FILE_CLOSE 1007        /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    54
#define ERR_BIB_NUM_BITS 1008          /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    55
#define ERR_BIB_FILE_NOT_OPEN 1009     /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    56
#define ERR_BIB_ILLEGAL_SIZE 1010      /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    57
#define ERR_BIB_CANNOT_REWIND 1011     /* If the number of bits requested to be
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    58
                                          rewinded is greater than the number
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    59
                                          of bits available in the buffer */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    60
#define ERR_BIB_BUFLIST 1012           /* If the internal buffer list has
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    61
                                          been corrupted */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    62
#define ERR_BIB_TOO_SMALL_BUFFER 1013  /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    63
#define ERR_BIB_FEC_RELOCK 1050        /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    64
#define ERR_BIB_PSC_FOUND 1060         /* Obsolete */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    65
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    66
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    67
/*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    68
 * Structs and typedefs
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    69
 */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    70
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    71
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    72
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    73
/* {{-output"bibBuffer_t_info.txt" -ignore"*" -noCR}}
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    74
 * The bibBuffer_t data type is a structure containing all the necessary data
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    75
 * for a bit buffer instance (except for the actual data buffer). This
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    76
 * structure is passed to all of the bit buffer functions.
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    77
 * {{-output"bibBuffer_t_info.txt"}}
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    78
 */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    79
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    80
/* {{-output"bibBuffer_t.txt"}} */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    81
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    82
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    83
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    84
enum CopyMode {
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    85
     CopyNone        = 0,
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    86
     CopyWhole       = 1,
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    87
     CopyWithEdit    = 2,
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    88
     EditOnly        = 3
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    89
};
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    90
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    91
typedef struct bibEditParams_s {
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    92
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    93
   int StartByteIndex;      // start byte position where data is to be written 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    94
   int StartBitIndex;       // start bit position where data is to be written 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    95
   int curNumBits;      // number of bits that need to be replaced 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    96
   int newNumBits;      // number of bits to be written 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    97
   int newValue;      // the value to be written 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    98
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
    99
} bibEditParams_t; 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   100
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   101
typedef struct bibBufferEdit_s {
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   102
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   103
    CopyMode copyMode; 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   104
    int numChanges; 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   105
    bibEditParams_t *editParams;
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   106
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   107
} bibBufferEdit_t; 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   108
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   109
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   110
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   111
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   112
typedef struct bibBuffer_s {
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   113
   u_char *baseAddr;       /* the start address of the buffer */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   114
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   115
   unsigned size;          /* the size of the buffer in bytes */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   116
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   117
   unsigned getIndex;      /* an index to the buffer where data was last got */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   118
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   119
   int bitIndex;           /* an index to the byte pointed by getIndex + 1 */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   120
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   121
   u_int32 bitsLeft;       /* the number of bits currently in the buffer */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   122
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   123
   u_int32 numBytesRead;   /* the total number of bytes read */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   124
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   125
   int error;               /* stores possible error code */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   126
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   127
} bibBuffer_t;
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   128
/* {{-output"bibBuffer_t.txt"}} */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   129
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   130
#ifdef DEBUG_OUTPUT
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   131
extern bibBuffer_t * buffer_global;
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   132
#endif
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   133
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   134
/* typedefs for bibFlushBits, bibGetBits, and bibShowBits function types */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   135
typedef void (*bibFlushBits_t) (int, bibBuffer_t *, int *, int *, int16 *);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   136
typedef u_int32 (*bibGetBits_t) (int, bibBuffer_t *, int *, int *, int16 *);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   137
typedef u_int32 (*bibShowBits_t) (int, bibBuffer_t *, int *, int *, int16 *);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   138
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   139
/*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   140
 * External macros
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   141
 */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   142
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   143
/*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   144
    * bibNumberOfBitsLeft
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   145
    *
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   146
    * Parameters:
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   147
    *    bibBuffer_t *buffer        input bit buffer instance
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   148
    *
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   149
    * Function:
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   150
    *    This macro returns the number of bits which are left to be read
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   151
    *    from the current position.
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   152
    *
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   153
    * Returns:
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   154
    *    See above.
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   155
    */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   156
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   157
   #define bibNumberOfBitsLeft(buffer) \
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   158
      ((buffer)->bitsLeft)
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   159
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   160
/*
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   161
 * External function prototypes
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   162
 */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   163
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   164
bibBuffer_t *bibCreate(void *srcBuffer, unsigned srcBufferLength,
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   165
   int16 *errorCode);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   166
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   167
void bibDelete(bibBuffer_t *buffer, int16 *errorCode);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   168
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   169
u_int32 bibNumberOfFlushedBits(bibBuffer_t *buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   170
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   171
u_int32 bibNumberOfFlushedBytes(bibBuffer_t *buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   172
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   173
u_int32 bibNumberOfRewBits(bibBuffer_t *buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   174
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   175
void bibRewindBits(u_int32 numberOfBits, bibBuffer_t *buffer, int16 *errorCode);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   176
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   177
int bibCheckPSCValidity( bibBuffer_t *buffer, int syncCodeLength );
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   178
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   179
void bibAddMPEG4Header( bibBuffer_t *buffer, u_int8 *data, int length, int16 *errorCode );
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   180
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   181
void bibMarkBufferWithPSC( bibBuffer_t *buffer, int16 *error );
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   182
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   183
/* 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   184
 * Prototypes for bibFlushBits/bibGetBits/bibShowBits 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   185
 */
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   186
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   187
void bibFlushBitsL(int numberOfBits, bibBuffer_t *buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   188
u_int32 bibGetBitsL(int numberOfBits, bibBuffer_t *buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   189
u_int32 bibShowBitsL(int numberOfBits, bibBuffer_t *buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   190
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   191
inline void bibFlushBits(int numberOfBits, bibBuffer_t *buffer, int *numberOfBitsGot, int * /*bitErrorIndication*/, int16 * /*errorCode*/)
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   192
{
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   193
    *numberOfBitsGot = numberOfBits;
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   194
    bibFlushBitsL(numberOfBits, buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   195
}
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   196
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   197
inline u_int32 bibGetBits(int numberOfBits, bibBuffer_t *buffer, int *numberOfBitsGot, int * /*bitErrorIndication*/, int16 * /*errorCode*/)
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   198
{
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   199
    *numberOfBitsGot = numberOfBits;
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   200
    return bibGetBitsL(numberOfBits, buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   201
}
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   202
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   203
inline u_int32 bibShowBits(int numberOfBits, bibBuffer_t *buffer, int *numberOfBitsGot, int * /*bitErrorIndication*/, int16 * /*errorCode*/)
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   204
{
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   205
    *numberOfBitsGot = numberOfBits;
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   206
    return bibShowBitsL(numberOfBits, buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   207
}
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   208
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   209
#define bibFlushBitsFromBuffer bibFlushBits
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   210
#define bibGetBitsFromBuffer bibGetBits
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   211
#define bibShowBitsFromBuffer bibShowBits
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   212
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   213
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   214
bibBufferEdit_t *bibBufferEditCreate(int16 *errorCode);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   215
void bibBufEditDelete(bibBufferEdit_t *bufEdit, int16 *errorCode);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   216
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   217
// copy from input buffer to output buffer in various copy modes (with or without editing)
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   218
void CopyStream(bibBuffer_t *SrcBuffer,bibBuffer_t *DestBuffer,bibBufferEdit_t *bufEdit, 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   219
								int ByteStart,int BitStart);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   220
// copy from input buffer to output buffer (without editing)
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   221
void CopyBuffer(bibBuffer_t *SrcBuffer,bibBuffer_t *DestBuffer, 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   222
								int ByteStart,int BitStart, int ByteEnd, int BitEnd);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   223
// copy from BufferEdit to output buffer (no copying; rather, inserting code into output buffer)
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   224
void CopyBufferEdit(bibBuffer_t *SrcBuffer, bibBuffer_t *DestBuffer, 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   225
										bibEditParams_t *edParam, int updateSrcBufferStats=1);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   226
// insert correct IntraDC values for H.263 chrominance blocks in output buffer
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   227
void ResetH263IntraDcUV(bibBuffer_t *DestBuffer, int uValue, int vValue); 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   228
// insert correct IntraDC values for MPEG-4 chrominance blocks in output buffer
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   229
void ResetMPEG4IntraDcUV(bibBuffer_t *DestBuffer, int IntraDC_size); 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   230
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   231
	/* 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   232
			SrcValue		the source value from which bits are to be extacted 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   233
			MaxNumBits	the length in bits of the source value
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   234
			StartBit		the index of the starting bit form where data is to be retrieved
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   235
			getBits			the number of bits to be retrieved 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   236
	*/
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   237
u_int32 bibGetBitsFromWordL(u_int32 SrcValue, u_int32 getBits, u_int32 *StartBit, 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   238
												u_int32 MaxNumBits);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   239
void bibForwardBits(u_int32 numberOfBits, bibBuffer_t *buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   240
void bibStuffBits(bibBuffer_t *buffer);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   241
void bibStuffBitsMPEG4(bibBuffer_t *inBuffer, bibBuffer_t *outBuffer, bibBufferEdit_t *bufEdit, 
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   242
											 int *StartByteIndex, int *StartBitIndex, int updateSrcBufferStats);
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   243
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   244
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   245
#endif
951a5db380a0 Committing the Video Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff changeset
   246
// End of File