Commit 04fd3db2 authored by Alberto Gonzalez's avatar Alberto Gonzalez

Commit 4 concept fork

```--------------------------------------------------
- Identificador de thread.
- Bool para identificar hijo o padre
```

---------------------------------------------------
parent f2f3bace
...@@ -85,6 +85,8 @@ ...@@ -85,6 +85,8 @@
sem_t* sem; sem_t* sem;
vectorModeCostStruct* vector; vectorModeCostStruct* vector;
std::string posNode; std::string posNode;
bool father;
int threadNumber;
void toStringVector() void toStringVector()
{ {
...@@ -319,7 +321,6 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps ) ...@@ -319,7 +321,6 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps )
//Comenzamos en el nodo 0 (único) del nivel 0 de 4 //Comenzamos en el nodo 0 (único) del nivel 0 de 4
posNode.append("0"); posNode.append("0");
} }
void EncCu::createAndInitSemaphore() void EncCu::createAndInitSemaphore()
...@@ -507,14 +508,17 @@ void EncCu::compressCtu(CodingStructure &cs, const UnitArea &area, const unsigne ...@@ -507,14 +508,17 @@ void EncCu::compressCtu(CodingStructure &cs, const UnitArea &area, const unsigne
//ALBERTO CONCEPT FORK //ALBERTO CONCEPT FORK
for (int i = 0; i < 1; i++) { for (int i = 0; i < 1; i++) {
pid_t pid = fork(); pid_t pid = fork();
if (pid == 0) { // proceso hijo if (pid != 0) { // proceso hijo
father = false;
threadNumber = i+1;
compressCtuForks(cs,area,ctuRsAddr,prevQP,currQP); compressCtuForks(cs,area,ctuRsAddr,prevQP,currQP);
exit(0);//proceso hijo muere exit(0);//proceso hijo muere
} }
else{
compressCtuForks(cs,area,ctuRsAddr,prevQP,currQP);
}
} }
wait(NULL);
father = true;
compressCtuForks(cs,area,ctuRsAddr,prevQP,currQP);
//END ALBERTO CONCEPT FORK //END ALBERTO CONCEPT FORK
} }
...@@ -1486,7 +1490,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, ...@@ -1486,7 +1490,6 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
//END ALBERTO CONCEPT FORK //END ALBERTO CONCEPT FORK
do do
{ {
const auto &subCUArea = partitioner.currArea(); const auto &subCUArea = partitioner.currArea();
if( tempCS->picture->Y().contains( subCUArea.lumaPos() ) ) if( tempCS->picture->Y().contains( subCUArea.lumaPos() ) )
{ {
...@@ -1503,11 +1506,16 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, ...@@ -1503,11 +1506,16 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
newMaxCostAllowed = std::max(0.0, newMaxCostAllowed); newMaxCostAllowed = std::max(0.0, newMaxCostAllowed);
//ALBERTO CONCEPT FORK //ALBERTO CONCEPT FORK
posNode.append(std::to_string(actualNodeId)); //INTRODUCIMOS SU ID DENTRO DEL PADRE posNode.append(std::to_string(actualNodeId)); //INTRODUCIMOS SU ID DENTRO DEL PADRE
//ELEGIMOS EL THREAD EN EL NIVEL 1 (CONTANDO DESDE 0).
if(!father && posNode.length() == 2 && vector[determinePosNodeInVector(posNode)].threadNumber!=threadNumber)
{
continue;
}
std::cout << "CONTROL --> código bucle split" << posNode << " : (" << tempSubCS->area.lheight() <<","<< tempSubCS->area.lwidth() <<") " << std::endl; std::cout << "CONTROL --> código bucle split" << posNode << " : (" << tempSubCS->area.lheight() <<","<< tempSubCS->area.lwidth() <<") " << std::endl;
if(posNode == "0311") /*if(posNode == "0311")
{ {
toStringVector(); toStringVector();
} }*/
//END ALBERTO CONCEPT FORK //END ALBERTO CONCEPT FORK
xCompressCU(tempSubCS, bestSubCS, partitioner, newMaxCostAllowed);//LLAMADA RECURSIVA xCompressCU(tempSubCS, bestSubCS, partitioner, newMaxCostAllowed);//LLAMADA RECURSIVA
//ALBERTO CONCEPT FORK //ALBERTO CONCEPT FORK
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment