OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
SpursSpeexTaskManager.h
1// Gamespy Technology
2// NOTE: this code has been provided by Sony for usage in Speex SPURS Manager
3
4/*
5Bullet Continuous Collision Detection and Physics Library
6Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com
7
8This software is provided 'as-is', without any express or implied warranty.
9In no event will the authors be held liable for any damages arising from the use of this software.
10Permission is granted to anyone to use this software for any purpose,
11including commercial applications, and to alter it and redistribute it freely,
12subject to the following restrictions:
13
141. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
152. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
163. This notice may not be removed or altered from any source distribution.
17*/
18
19#ifndef SPU_SAMPLE_TASK_PROCESS_H
20#define SPU_SAMPLE_TASK_PROCESS_H
21
22#include <assert.h>
23
24
25#include "spursPlatformDefinitions.h"
26
27#include <stdlib.h>
28
29#include "spursAlignedObjectArray.h"
30
31#include "SpuSpeexTaskOutput.h"
32
34struct SpursSpeexTaskDesc
35{
36 SpursSpeexTaskDesc()
37 :mDebugPause(false)
38 {
39
40 }
41 int mQuality;
42 int mSamplesPerSecond;
43 int mEncodedFrameSize;
44 void *mInputBuffer; // make it
45 unsigned int mInputBufferSize;
46
47 SpursSpeexTaskOutput *mSpeexTaskOutput;
48 void *mOutputBuffer;
49 unsigned int mOutputBufferSize;
50
51 char *mSpeexStateBuffer;
52 unsigned int mSpeexStateBufferSize;
53 bool mDebugPause;
54
55 uint16_t mTaskId;
56 //uint16_t _padding_[3]; //padding to make this multiple of 16 bytes
57} POST_ALIGN(128);
58
59//just add your commands here, try to keep them globally unique for debugging purposes
60#define SPEEX_TASK_ENCODE_COMMAND 10
61#define SPEEX_TASK_ENCODE_INIT_COMMAND 11
62#define SPEEX_TASK_DECODEADD_COMMAND 12
63#define SPEEX_TASK_DECODESET_COMMAND 13
64#define SPEEX_TASK_DECODE_INIT_COMMAND 14
65
66
67
71class SpursSpeexTaskManager
72{
73 // track task buffers that are being used, and total busy tasks
76
77 unsigned int m_numBusyTasks;
78
79 // the current task and the current entry to insert a new work unit
80 unsigned int m_currentTask;
81
82 bool m_initialized;
83
84 //void postProcess(int taskId, int outputSize);
85
86 class spursThreadSupportInterface* m_threadInterface;
87
88 unsigned int m_maxNumOutstandingTasks;
89
90
91 int issueTask(SpursSpeexTaskDesc& taskDesc,uint32_t uiCommand);
92
93
94public:
95 SpursSpeexTaskManager(spursThreadSupportInterface* threadInterface, unsigned int maxNumOutstandingTasks);
96
97 ~SpursSpeexTaskManager();
98
100 int initialize();
101
102 int issueEncodeTask(int16_t * inBuffer, int inBufferSize, int encodedFrameSize, char *outBuffer, int outBufferSize,
103 SpursSpeexTaskOutput *taskOuput,char *m_userAllocatedSpeexBuffer,int userAllocatedSpeexBufferSize);
104
105 int issueEncodeInitTask(int theQuality,int theGviSpeexSamplesPerSecond, SpursSpeexTaskOutput *taskOutput, char *m_userAllocatedSpeexBuffer,
106 int userAllocatedSpeexBufferSize);
107
108 int issueDecodeAddTask(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize,
109 short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput);
110
111 int issueDecodeSetTask(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize,
112 short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput);
113
114 int issueDecodeInitTask(char *decoderStateBuffer, int decoderStateBufferSize, int sampleRate, struct SpursSpeexTaskOutput *taskOutput);
115
117 int flush();
118};
119
120
121#endif // SPU_SAMPLE_TASK_PROCESS_H
122
int flush()
call flush to submit potential outstanding work to SPUs and wait for all involved SPUs to be finished
Definition SpursSpeexTaskManager.cpp:251
int initialize()
call initialize in the beginning of the frame, before addCollisionPairToTask
Definition SpursSpeexTaskManager.cpp:82
Definition spursAlignedObjectArray.h:50
Definition spursthreadsupportinterface.h:25
SpuSampleTaskDesc.
Definition SpursSpeexTaskManager.h:35
pure output, any input is in SpuSampleTaskDesc
Definition SpuSpeexTaskOutput.h:21