-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjxltranslator.h
54 lines (44 loc) · 1.94 KB
/
jxltranslator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Copyright 2021, Craig Watson <watsoncraigjohn@gmail.com>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#ifndef JXLTRANSLATOR_H
#define JXLTRANSLATOR_H
#include "BaseTranslator.h"
#include <TranslationKit.h>
#include <TranslatorAddOn.h>
#define JXL_TRANSLATOR_VERSION B_TRANSLATION_MAKE_VERSION(0,1,0)
#define JXL_FORMAT 'JXL '
#define JXL_TRANSLATOR_SETTINGS "JXLTranslatorSettings"
#define JXL_IN_QUALITY 0.7
#define JXL_IN_CAPABILITY 0.8
#define JXL_OUT_QUALITY 0.7
#define JXL_OUT_CAPABILITY 0.6
#define BBT_IN_QUALITY 0.7
#define BBT_IN_CAPABILITY 0.6
#define BBT_OUT_QUALITY 0.7
#define BBT_OUT_CAPABILITY 0.6
#define JXL_SETTING_DISTANCE "JXL_SETTING_DISTANCE"
#define JXL_SETTING_EFFORT "JXL_SETTING_EFFORT"
#define JXL_DEFAULT_DISTANCE 1 // visually lossless, 0-15 higher = worse
#define JXL_DEFAULT_EFFORT 7 // 3-9 higher = slower
class JXLTranslator : public BaseTranslator {
public:
JXLTranslator(void);
virtual status_t DerivedIdentify(BPositionIO* inSource, const translation_format* inFormat, BMessage* ioExtension, translator_info * outInfo, uint32 outType);
virtual status_t DerivedTranslate(BPositionIO* inSource, const translator_info *inInfo, BMessage* ioExtension, uint32 outType, BPositionIO* outDestination, int32 baseType);
virtual BView* NewConfigView(TranslatorSettings* settings);
protected:
virtual ~JXLTranslator(void);
private:
status_t IdentifyJXL(BPositionIO *inSource, translator_info *outInfo);
status_t PopulateInfoFromFormat(translator_info* info,
uint32 formatType, translator_id id=0);
status_t PopulateInfoFromFormat(translator_info* info,
uint32 formatType, const translation_format* formats, int32 formatCount);
status_t Decompress(BPositionIO* in, BPositionIO* out);
status_t Compress(BPositionIO* in, BPositionIO* out);
status_t BitmapPixelsToJxl(uint8* pixels, size_t size, int xsize, int ysize, uint32 bpp,
int alphabits, uint32 align, BPositionIO* out);
};
#endif