Residual coding

This commit is contained in:
Ali
2022-07-29 18:32:51 +02:00
parent 64076541cd
commit f6ad7dc77a
35 changed files with 2784 additions and 498 deletions

View File

@@ -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