Example #1
0
File: Unit.py Project: tuzm24/DN
def recalcPosition(_cf, srcCld, dstCld, pos):
    if (1 if srcCld == Component.COMPONENT_Y else
            0) == (1 if dstCld == Component.COMPONENT_Y else 0):
        return pos
    if srcCld == Component.COMPONENT_Y and dstCld != Component.COMPONENT_Y:
        return Position(pos.x >> ChromaScale, pos.y >> ChromaScale)
    return Position(pos.x << ChromaScale, pos.y << ChromaScale)
Example #2
0
File: Unit.py Project: tuzm24/DN
 def __eq__(self, other):
     if self.chromaFormat != other.chromaFormat:
         return False
     if self.compID != other.compID:
         return False
     return Position.__eq__(self, other) and Size.__eq__(self, other)
Example #3
0
File: Unit.py Project: tuzm24/DN
 def bottomRightComp(self, _compID):
     return recalcPosition(
         self.chromaFormat, self.compID, _compID,
         Position(self.x + self.width - 1, self.y + self.height - 1))
Example #4
0
File: Unit.py Project: tuzm24/DN
 def bottomLeftComp(self, _compID):
     return recalcPosition(self.chromaFormat, self.compID, _compID,
                           Position(self.x, self.y + self.height - 1))
Example #5
0
File: Unit.py Project: tuzm24/DN
 def topRightComp(self, _compID):
     return recalcPosition(self.chromaFormat, self.compID, _compID,
                           Position(self.x + self.width - 1, self.y))
Example #6
0
File: Unit.py Project: tuzm24/DN
 def lumaPos(self):
     if self.compID != Component.COMPONENT_Y:
         return Position(self.x << ChromaScale, self.y << ChromaScale)
     return Position(self.x, self.y)
Example #7
0
File: Unit.py Project: tuzm24/DN
 def chromaSize(self):
     if self.compID == Component.COMPONENT_Y:
         return Position(self.x >> ChromaScale, self.y >> ChromaScale)
     return Position(self.x, self.y)