1
// Copyright 2011 Google Inc.
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
7
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
15
// This header only exists to avoid including jpeglib.h, etc directly
16
// in jpeg_optimizer_test.cc, since doing so causes symbol collisions on
19
#ifndef PAGESPEED_KERNEL_IMAGE_JPEG_OPTIMIZER_TEST_HELPER_H_
20
#define PAGESPEED_KERNEL_IMAGE_JPEG_OPTIMIZER_TEST_HELPER_H_
22
#include "pagespeed/kernel/base/string.h"
24
namespace pagespeed_testing {
25
namespace image_compression {
27
// Helper that extracts the number of components and h/v sampling factors.
28
bool GetJpegNumComponentsAndSamplingFactors(
29
const GoogleString& jpeg,
30
int* out_num_components,
31
int* out_h_samp_factor,
32
int* out_v_samp_factor);
34
// Helper function to check present of given segment.
35
bool IsJpegSegmentPresent(const GoogleString& data, int segment);
37
// Helper function that returns num of progessive scans for the image.
38
int GetNumScansInJpeg(const GoogleString& data);
40
// Helper function to return the color profile segment marker.
41
int GetColorProfileMarker();
43
// Helper function to return the exif data segment marker.
44
int GetExifDataMarker();
46
} // namespace image_compression
47
} // namespace pagespeed_testing
49
#endif // PAGESPEED_KERNEL_IMAGE_JPEG_OPTIMIZER_TEST_HELPER_H_