00001 #include "YUVGOPVector.hpp" 00002 #include "YUVGOP.hpp" 00003 00004 int YUVGOPVector::compareItems(QPtrCollection::Item xx, QPtrCollection::Item yy) { 00005 00006 YUVGOP* x = (YUVGOP*) xx; 00007 YUVGOP* y = (YUVGOP*) yy; 00008 00009 if (sortOrder == PSNR) { 00010 if (x->getPSNR() > y->getPSNR()) 00011 return 1; 00012 if (x->getPSNR() < y->getPSNR()) 00013 return -1; 00014 return 0; 00015 } 00016 00017 if (sortOrder == PSNR_DESC) { 00018 if (x->getPSNR() > y->getPSNR()) 00019 return -1; 00020 if (x->getPSNR() < y->getPSNR()) 00021 return 1; 00022 return 0; 00023 } 00024 00025 if (sortOrder == COMPR_BYTE_SIZE) { 00026 if (x->getCompressedByteSize() > y->getCompressedByteSize()) 00027 return 1; 00028 if (x->getCompressedByteSize() < y->getCompressedByteSize()) 00029 return -1; 00030 return 0; 00031 } 00032 00033 return 0; 00034 } 00035 00036 void YUVGOPVector::setSortOrder(SortOrder s) { 00037 sortOrder = s; 00038 }