mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Residual coding
This commit is contained in:
@@ -13,10 +13,25 @@
|
||||
|
||||
@implementation ImageDCTTable
|
||||
|
||||
- (instancetype _Nonnull)initWithQuality:(NSInteger)quality isChroma:(bool)isChroma {
|
||||
- (instancetype _Nonnull)initWithQuality:(NSInteger)quality type:(ImageDCTTableType)type; {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_table = dct::DCTTable::generate((int)quality, isChroma);
|
||||
dct::DCTTable::Type mappedType;
|
||||
switch (type) {
|
||||
case ImageDCTTableTypeLuma:
|
||||
mappedType = dct::DCTTable::Type::Luma;
|
||||
break;
|
||||
case ImageDCTTableTypeChroma:
|
||||
mappedType = dct::DCTTable::Type::Chroma;
|
||||
break;
|
||||
case ImageDCTTableTypeDelta:
|
||||
mappedType = dct::DCTTable::Type::Delta;
|
||||
break;
|
||||
default:
|
||||
mappedType = dct::DCTTable::Type::Luma;
|
||||
break;
|
||||
}
|
||||
_table = dct::DCTTable::generate((int)quality, mappedType);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -63,4 +78,12 @@
|
||||
_dct->inverse(coefficients, pixels, (int)width, (int)height, (int)coefficientsPerRow, (int)bytesPerRow);
|
||||
}
|
||||
|
||||
- (void)forward4x4:(int16_t const * _Nonnull)normalizedCoefficients coefficients:(int16_t * _Nonnull)coefficients width:(NSInteger)width height:(NSInteger)height {
|
||||
_dct->forward4x4(normalizedCoefficients, coefficients, (int)width, (int)height);
|
||||
}
|
||||
|
||||
- (void)inverse4x4:(int16_t const * _Nonnull)coefficients normalizedCoefficients:(int16_t * _Nonnull)normalizedCoefficients width:(NSInteger)width height:(NSInteger)height {
|
||||
_dct->inverse4x4(coefficients, normalizedCoefficients, (int)width, (int)height);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user