2 * Copyright 2010-2017, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
8 #ifndef WEBP_TRANSLATOR_H
9 #define WEBP_TRANSLATOR_H
12 #include <ByteOrder.h>
16 #include <GraphicsDefs.h>
17 #include <InterfaceDefs.h>
18 #include <TranslationDefs.h>
19 #include <Translator.h>
20 #include <TranslatorFormats.h>
22 #include "BaseTranslator.h"
24 #define WEBP_TRANSLATOR_VERSION B_TRANSLATION_MAKE_VERSION(0,6,0)
25 #define WEBP_IMAGE_FORMAT 'WebP'
27 #define WEBP_SETTING_QUALITY "quality"
28 #define WEBP_SETTING_PRESET "preset"
29 #define WEBP_SETTING_SHARPNESS "sharpness"
30 #define WEBP_SETTING_METHOD "method"
31 #define WEBP_SETTING_PREPROCESSING "preprocessing"
34 #define WEBP_IN_QUALITY 0.90
35 #define WEBP_IN_CAPABILITY 0.90
37 #define WEBP_OUT_QUALITY 0.90
38 #define WEBP_OUT_CAPABILITY 0.5
40 #define BITS_IN_QUALITY 0.8
41 #define BITS_IN_CAPABILITY 0.6
43 #define BITS_OUT_QUALITY 0.5
44 #define BITS_OUT_CAPABILITY 0.4
50 class WebPTranslator
: public BaseTranslator
{
54 virtual status_t
DerivedIdentify(BPositionIO
* stream
,
55 const translation_format
* format
,
56 BMessage
* settings
, translator_info
* info
,
59 virtual status_t
DerivedTranslate(BPositionIO
* stream
,
60 const translator_info
* info
,
61 BMessage
* settings
, uint32 outType
,
62 BPositionIO
* target
, int32 baseType
);
64 virtual BView
* NewConfigView(TranslatorSettings
* settings
);
67 virtual ~WebPTranslator();
68 // this is protected because the object is deleted by the
69 // Release() function instead of being deleted directly by
73 status_t
_TranslateFromBits(BPositionIO
* stream
,
74 BMessage
* settings
, uint32 outType
,
77 status_t
_TranslateFromWebP(BPositionIO
* stream
,
78 BMessage
* settings
, uint32 outType
,
81 static int _EncodedWriter(const uint8_t* data
,
83 const WebPPicture
* const picture
);
87 #endif // #ifndef WEBP_TRANSLATOR_H