#ifndef DEC_TEST_H
#define DEC_TEST_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "avcdec_api.h"
#include "avcdec_int.h"

#include "avcdec_lib.h"

#include "../u_kernel.h"

#ifndef APP_MUTEX_NUM
#define APP_MUTEX_NUM 10
#endif


typedef unsigned char uint8_t;

#ifndef false
    #define false 0
#endif

#ifndef true
    #define true 1
#endif

/* dump file */
//#define dumpFile

static const char kStartCode[4] = { 0x00, 0x00, 0x00, 0x01 };

void AVCDecInit(AVCHandle * Handle,int *SPSSeen,int *PPSSeen,int * h264_offset);
int DecNALUnit (AVCHandle *mHandle,const uint8_t *NALUnit,const int NALSize,int *mSPSSeen,int *mPPSSeen);
int ReadNALUnit(const uint8_t * H264_File , int H264_Offset ,int H264_Size ,const uint8_t ** NALUnit ,int *NALSize );

int waveFront();

int thr_decode_one_row(int arg);
int checkNeighborMB(AVCCommonObj* video , AVCMacroblock* currMB);

#define THREAD_COUNT 3

extern int res_allocate[THREAD_COUNT];
extern int thr_ready[THREAD_COUNT];
extern int* enable_thr;

extern int slice_end_flag;

extern uint8 **intra_pred_top;
extern uint8 **intra_pred_top_cb;
extern uint8 **intra_pred_top_cr;

/* mutex */
#define CORE0_MUTEX_NUM 0
#define CORE1_MUTEX_NUM 1
#define CORE2_MUTEX_NUM 2
#define CORE3_MUTEX_NUM 3

int core_mutex_id[THREAD_COUNT];


#endif
