1/* 2Copyright 2011 Google Inc. All Rights Reserved. 3 4Licensed under the Apache License, Version 2.0 (the "License"); 5you may not use this file except in compliance with the License. 6You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10Unless required by applicable law or agreed to in writing, software 11distributed under the License is distributed on an "AS IS" BASIS, 12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13See the License for the specific language governing permissions and 14limitations under the License. 15 16Author: lode.vandevenne@gmail.com (Lode Vandevenne) 17Author: jyrki.alakuijala@gmail.com (Jyrki Alakuijala) 18*/ 19 20#include "zopfli.h" 21 22#include "deflate.h" 23#include "gzip_container.h" 24#include "zlib_container.h" 25 26#include <assert.h> 27 28void ZopfliCompress(const ZopfliOptions* options, ZopfliFormat output_type, 29 const unsigned char* in, size_t insize, 30 unsigned char** out, size_t* outsize) { 31 if (output_type == ZOPFLI_FORMAT_GZIP) { 32 ZopfliGzipCompress(options, in, insize, out, outsize); 33 } else if (output_type == ZOPFLI_FORMAT_ZLIB) { 34 ZopfliZlibCompress(options, in, insize, out, outsize); 35 } else if (output_type == ZOPFLI_FORMAT_DEFLATE) { 36 unsigned char bp = 0; 37 ZopfliDeflate(options, 2 /* Dynamic block */, 1, 38 in, insize, &bp, out, outsize); 39 } else { 40 assert(0); 41 } 42} 43