TCP: Fixed RTO update and dup ACKs generation.
[haiku.git] / src / add-ons / translators / webp / WebPTranslator.h
blob35764b6095031f29a2cb186dc62f66353d9804c0
1 /*
2 * Copyright 2010-2017, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Philippe Houdoin
7 */
8 #ifndef WEBP_TRANSLATOR_H
9 #define WEBP_TRANSLATOR_H
12 #include <ByteOrder.h>
13 #include <DataIO.h>
14 #include <File.h>
15 #include <fs_attr.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
47 struct WebPPicture;
50 class WebPTranslator : public BaseTranslator {
51 public:
52 WebPTranslator();
54 virtual status_t DerivedIdentify(BPositionIO* stream,
55 const translation_format* format,
56 BMessage* settings, translator_info* info,
57 uint32 outType);
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);
66 protected:
67 virtual ~WebPTranslator();
68 // this is protected because the object is deleted by the
69 // Release() function instead of being deleted directly by
70 // the user
72 private:
73 status_t _TranslateFromBits(BPositionIO* stream,
74 BMessage* settings, uint32 outType,
75 BPositionIO* target);
77 status_t _TranslateFromWebP(BPositionIO* stream,
78 BMessage* settings, uint32 outType,
79 BPositionIO* target);
81 static int _EncodedWriter(const uint8_t* data,
82 size_t dataSize,
83 const WebPPicture* const picture);
87 #endif // #ifndef WEBP_TRANSLATOR_H