Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
copyright lines. more succinct zlib stuff. authors file. updates to l…
Browse files Browse the repository at this point in the history
…icenses
  • Loading branch information
Brian Whitman committed Jun 6, 2011
1 parent 9aa2d2e commit c16c416
Show file tree
Hide file tree
Showing 25 changed files with 118 additions and 8,209 deletions.
8 changes: 8 additions & 0 deletions AUTHORS
@@ -0,0 +1,8 @@
echoprint-codegen was written by

Dan Ellis <dpwe@ee.columbia.edu>
Brian Whitman <brian@echonest.com>
Alastair Porter <alastair@porter.net.nz>

and is Copyright 2011 The Echo Nest Corporation.

27 changes: 26 additions & 1 deletion LICENSE
@@ -1,3 +1,6 @@
echoprint-codegen is open source software licensed under the "MIT License"
More information about the MIT License: http://en.wikipedia.org/wiki/MIT_License

Copyright (c) 2011 The Echo Nest Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -16,4 +19,26 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.


libcodegen makes use of the following pieces of software:

- Murmurhash by Austin Appleby (Public Domain / MIT)
http://sites.google.com/site/murmurhash/

- Boost (Boost Software License)
http://www.boost.org/users/license.html

- Base64.cpp and Base64.h, see source files for license
Copyright (C) 2004-2008 René Nyffenegger


codegen (the example binary that the makefile also builds) makes use of libcodegen and:

- Taglib (LGPL)
http://developer.kde.org/~wheeler/taglib.html

- ffmpeg (via system shell, you must install ffmpeg on your own)
http://www.ffmpeg.org/legal.html

3 changes: 2 additions & 1 deletion src/AudioBufferInput.cxx
@@ -1,5 +1,6 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//

#include <string.h>
Expand Down
4 changes: 3 additions & 1 deletion src/AudioBufferInput.h
@@ -1,8 +1,10 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//



#include "Common.h"
#include <iostream>
#include <string>
Expand Down
4 changes: 3 additions & 1 deletion src/AudioStreamInput.cxx
@@ -1,8 +1,10 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//



#include <stddef.h>
#include <stdio.h>
#include <iostream>
Expand Down
4 changes: 3 additions & 1 deletion src/AudioStreamInput.h
@@ -1,7 +1,9 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


#ifndef AUDIOSTREAMINPUT_H
#define AUDIOSTREAMINPUT_H
#include "Common.h"
Expand Down
33 changes: 26 additions & 7 deletions src/Codegen.cxx
@@ -1,7 +1,9 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


#include <sstream>
#include <iostream>
#include <iomanip>
Expand All @@ -10,7 +12,7 @@
#include "Fingerprint.h"

#include "Base64.h"
#include "easyzlib.h"
#include <zlib.h>

Fingerprint* Codegen::computeFingerprint(SubbandAnalysis *pSubbandAnalysis, int start_offset) {
Fingerprint *pFingerprint = new Fingerprint(pSubbandAnalysis, start_offset);
Expand Down Expand Up @@ -53,10 +55,27 @@ string Codegen::createCodeString(vector<FPCode> vCodes) {


string Codegen::compress(const string& s) {
long nDest = (long)EZ_COMPRESSMAXDESTLENGTH((float)s.size());
unsigned char *pDest = new unsigned char[nDest];
ezcompress(pDest, &nDest, (unsigned char*)s.c_str(), s.size());
string encoded = base64_encode(pDest, nDest, true);
delete [] pDest;
long max_compressed_length = s.size()*2;
unsigned char *compressed = new unsigned char[max_compressed_length];

// zlib the code string
z_stream stream;
stream.next_in = (Bytef*)(unsigned char*)s.c_str();
stream.avail_in = (uInt)s.size();
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
stream.opaque = (voidpf)0;
deflateInit(&stream, Z_DEFAULT_COMPRESSION);
do {
stream.next_out = compressed;
stream.avail_out = max_compressed_length;
if(deflate(&stream, Z_FINISH) == Z_STREAM_END) break;
} while (stream.avail_out == 0);
uint compressed_length = stream.total_out;
deflateEnd(&stream);

// base64 the zlib'd code string
string encoded = base64_encode(compressed, compressed_length, true);
delete [] compressed;
return encoded;
}
6 changes: 4 additions & 2 deletions src/Codegen.h
@@ -1,12 +1,14 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


#ifndef CODEGEN_H
#define CODEGEN_H

// Entry point for generating codes from PCM data.
#define VERSION 4.00
#define VERSION 4.10

#include <memory>
#include <string>
Expand Down
4 changes: 3 additions & 1 deletion src/Common.h
@@ -1,7 +1,9 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


#ifndef COMMON_H
#define COMMON_H

Expand Down
4 changes: 3 additions & 1 deletion src/File.h
@@ -1,7 +1,9 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


#ifndef FILE_H
#define FILE_H
#include <string.h>
Expand Down
4 changes: 3 additions & 1 deletion src/Fingerprint.cxx
@@ -1,7 +1,9 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


#include "Fingerprint.h"
#include "Params.h"

Expand Down
4 changes: 3 additions & 1 deletion src/Fingerprint.h
@@ -1,8 +1,10 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//



#ifndef FINGERPRINT_H
#define FINGERPRINT_H

Expand Down
5 changes: 2 additions & 3 deletions src/Makefile
Expand Up @@ -16,13 +16,12 @@ MODULES_LIB = \
Fingerprint.o \
MatrixUtility.o \
SubbandAnalysis.o \
VectorUtility.o \
easyzlib.o
VectorUtility.o
MODULES = $(MODULES_LIB) Metadata.o

main: $(MODULES) main.o
$(CXX) $(MODULES) $(LDFLAGS) main.o -o ../codegen.$(UNAME)-$(ARCH)
$(CXX) -shared -fPIC -o libcodegen.$(UNAME)-$(ARCH).so $(MODULES_LIB)
$(CXX) -shared -fPIC -o libcodegen.$(UNAME)-$(ARCH).so $(MODULES_LIB) -lz
ifeq ($(UNAME),Darwin)
libtool -dynamic -flat_namespace -install_name libcodegen.4.0.0.dylib -lSystem -compatibility_version 4.0 -macosx_version_min 10.6 \
-current_version 4.0.0 -o libcodegen.4.0.0.dylib -undefined suppress \
Expand Down
4 changes: 3 additions & 1 deletion src/MatrixUtility.cxx
@@ -1,8 +1,10 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//



#include "VectorUtility.h"
#include "MatrixUtility.h"

Expand Down
4 changes: 3 additions & 1 deletion src/MatrixUtility.h
@@ -1,8 +1,10 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//



#ifndef MATRIXUTILITY_H
#define MATRIXUTILITY_H

Expand Down
3 changes: 2 additions & 1 deletion src/Metadata.cxx
@@ -1,5 +1,6 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


Expand Down
4 changes: 3 additions & 1 deletion src/Metadata.h
@@ -1,8 +1,10 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//



#ifndef METADATA_H
#define METADATA_H

Expand Down
4 changes: 3 additions & 1 deletion src/Params.h
@@ -1,8 +1,10 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//



#ifndef PARAMS_H
#define PARAMS_H

Expand Down
4 changes: 3 additions & 1 deletion src/SubbandAnalysis.cxx
@@ -1,5 +1,7 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


#include "SubbandAnalysis.h"
Expand Down
4 changes: 3 additions & 1 deletion src/SubbandAnalysis.h
@@ -1,7 +1,9 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//


#ifndef SUBBANDANALYSIS_H
#define SUBBANDANALYSIS_H
#include "Common.h"
Expand Down
4 changes: 3 additions & 1 deletion src/VectorUtility.cxx
@@ -1,8 +1,10 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//



#include "VectorUtility.h"
#include <stddef.h>
#include <math.h>
Expand Down
4 changes: 3 additions & 1 deletion src/VectorUtility.h
@@ -1,8 +1,10 @@
//
// Copyright 2011 The Echo Nest. All rights reserved.
// echoprint-codegen
// Copyright 2011 The Echo Nest Corporation. All rights reserved.
//



#ifndef VECTORUTILITY_H
#define VECTORUTILITY_H

Expand Down

0 comments on commit c16c416

Please sign in to comment.