Skip to content

Commit

Permalink
it works
Browse files Browse the repository at this point in the history
  • Loading branch information
kk60503 committed Sep 25, 2023
1 parent 3bd4c00 commit 1b2f959
Show file tree
Hide file tree
Showing 32 changed files with 110 additions and 830 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ dmypy.json

# Vagrant
.vagrant/

.DS_Store

16 changes: 5 additions & 11 deletions olaf/bpe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# are for pybind11 usage with Mac M1+ OS. Please comment out as needed.

# select compiler for C and C++
CC = gcc
CXX = g++


Expand Down Expand Up @@ -39,21 +38,16 @@ BPE_SOURCES = \
$(BPE_SRC)/PatternCoding.c \
$(BPE_SRC)/waveletbpe.c \
$(BPE_SRC)/main_pybind.c

CFLAGS = \
-g -Wall $(INC_DIRS) -fPIC \
$(shell python3-config --includes --cflags) \
$(shell python3 -m pybind11 --includes)

#-Wno-sign-compare Wno-unused-but-set-variable Wno-absolute-value Wno-self-assign

# above line is to ignore certain warning during testing

CXXFLAGS = \
-std=c++11 -g -Wall $(INC_DIRS) -fPIC \
$(shell python3-config --includes --cflags) \
$(shell python3 -m pybind11 --includes)

#-Wno-sign-compare Wno-unused-but-set-variable Wno-absolute-value Wno-self-assign
# above line is to ignore certain warning during testing

LDFLAGS = -lm $(shell python3-config --ldflags)

#-Wl,-ld_classic -undefined dynamic_lookup
Expand All @@ -65,10 +59,10 @@ OBJS = $(PYLIB_SOURCES:%.cpp=$(BUILD_DIR)/%.o) $(BPE_SOURCES:%.c=$(BUILD_DIR)/%.

$(BUILD_DIR)/%.o: %.c
@mkdir -p $(BUILD_DIR)/$(BPE_SRC)
$(CC) -c $< -o $@ $(CFLAGS)
$(CXX) -c $< -o $@ $(CXXFLAGS)

$(BUILD_DIR)/%.o: %.cpp
@mkdir -p $(BUILD_DIR)
@mkdir -p $(BUILD_DIR)/$(BPE_SRC)
$(CXX) -c $< -o $@ $(CXXFLAGS)

$(LINK_TARGET): $(OBJS)
Expand Down
Empty file modified olaf/bpe/README.md
100644 → 100755
Empty file.
Empty file modified olaf/bpe/cfc.py
100644 → 100755
Empty file.
Empty file modified olaf/bpe/pixel_check.py
100644 → 100755
Empty file.
9 changes: 2 additions & 7 deletions olaf/bpe/source/AC_BitPlaneCoding.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@ Nov. 3, 2006

#include <stdlib.h>
#include <math.h>
//#include "global.h"
#include "main_pybind.h"
#include "global.h"
//#include "main_pybind.h"

extern void BlockScanEncode(StructCodingPara *PtrCoding, BitPlaneBits *BlockInfo);

extern void StagesEnCoding(StructCodingPara *PtrCoding, BitPlaneBits *BlockInfo);

extern void StagesDeCoding(StructCodingPara *PtrCoding, BitPlaneBits *BlockInfo);

void ACDepthEncoder(StructCodingPara *PtrCoding, BitPlaneBits *BlockInfo);

Expand Down
5 changes: 2 additions & 3 deletions olaf/bpe/source/AdjustOutput.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ Nov. 3, 2006

#include <stdlib.h>
#include <math.h>
//#include "global.h"
#include "main_pybind.h"
#include "global.h"
//#include "main_pybind.h"

extern long DeConvTwosComp(DWORD32 complement, short leftmost);

void AdjustOutPut(StructCodingPara * PtrCoding, BitPlaneBits * BlockCodingInfo)// need to adjust the output
{
Expand Down
4 changes: 2 additions & 2 deletions olaf/bpe/source/BPEBlockCoding.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Nov. 3, 2006
*/
#include <stdlib.h>
#include <math.h>
//#include "global.h"
#include "main_pybind.h"
#include "global.h"
//#include "main_pybind.h"

void BlockScanEncode(StructCodingPara *PtrCoding,
BitPlaneBits *BlockInfo)
Expand Down
Empty file modified olaf/bpe/source/CoeffGroup.c
100644 → 100755
Empty file.
6 changes: 2 additions & 4 deletions olaf/bpe/source/DC_EnDeCoding.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ Nov. 3, 2006
*/
#include <math.h>
#include <stdlib.h>
//#include "global.h"
#include "main_pybind.h"
#include "global.h"
//#include "main_pybind.h"


long DeConvTwosComp(DWORD32 complement,
short leftmost);

extern void HeaderOutput(StructCodingPara *PtrCoding);

long DeConvTwosComp(DWORD32 complement,
short leftmost)
{
Expand Down
23 changes: 2 additions & 21 deletions olaf/bpe/source/PatternCoding.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,15 @@ Nov. 3, 2006

#include <stdio.h>
#include <stdlib.h>
//#include "global.h"
#include "main_pybind.h"
#include "global.h"
//#include "main_pybind.h"

const int bit2_pattern[] = {0, 2, 1, 3};
const int bit3_pattern[] = {1, 4, 0, 5, 2, 6, 3, 7};
const int bit3_pattern_TranD[] = {0, 3, 0, 4, 1, 5, 2, 6};
const int bit4_pattern_TypeCi[] = {10, 1, 3, 6, 2, 5, 9, 12, 0, 8, 7, 13, 4, 14, 11, 15};
const int bit4_pattern_TypeHij_TranHi[] = {0, 1, 3, 6, 2, 5, 9, 11, 0, 8, 7, 12, 4, 13, 10, 14};

extern void StagesEnCodingGaggles1(StructCodingPara *PtrCoding,
BitPlaneBits *BlockInfo,
UCHAR8 BlocksInGaggles,
UCHAR8 Option[],
BOOL FlagCodeOptionOutput[]);

extern void StagesEnCodingGaggles2(StructCodingPara *PtrCoding,
BitPlaneBits *BlockInfo,
UCHAR8 BlocksInGaggles,
UCHAR8 Option[],
BOOL FlagCodeOptionOutput[]);

extern void StagesEnCodingGaggles3(StructCodingPara *PtrCoding,
BitPlaneBits *BlockInfo,
UCHAR8 BlocksInGaggles,
UCHAR8 Option[],
BOOL FlagCodeOptionOutput[]);



void PatternMapping(StrSymbolDetails *StrSymbol)
{
Expand Down
7 changes: 0 additions & 7 deletions olaf/bpe/source/README.rtf

This file was deleted.

16 changes: 2 additions & 14 deletions olaf/bpe/source/StagesCodingGaggles.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ Your comment and suggestions are welcome. Please report bugs to me via email and
Nov. 3, 2006
*/

//#include "global.h"
#include "main_pybind.h"
#include "global.h"
//#include "main_pybind.h"
#include <stdlib.h>
#include <stdio.h>

extern void RiceCoding(short InputVal,
short BitLength,
UCHAR8 *Option,
StructCodingPara *PtrCoding );

extern void BitPlaneSymbolReset(StrSymbolDetails *SymbolStr);

void StagesEnCodingGaggles1(StructCodingPara *PtrCoding, BitPlaneBits *BlockInfo,
UCHAR8 BlocksInGaggles, UCHAR8 Option[], BOOL FlagCodeOptionOutput[])
Expand Down Expand Up @@ -235,12 +229,6 @@ void StagesEnCodingGaggles3(StructCodingPara *PtrCoding,
}
}

extern void RiceDecoding(DWORD32 *decoded,
short BitLength,
UCHAR8 *splitOption,
StructCodingPara *Ptr);

extern void DeMappingPattern(StrSymbolDetails *StrSymbol);

void StagesDeCodingGaggles1(StructCodingPara *PtrCoding,
BitPlaneBits *BlockCodingInfo,
Expand Down
Binary file removed olaf/bpe/source/UNL_readme.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions olaf/bpe/source/bitsIO.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Your comment and suggestions are welcome. Please report bugs to me via email and
Nov. 3, 2006
*/
#include <stdlib.h>
//#include "global.h"
#include "main_pybind.h"
#include "global.h"
//#include "main_pybind.h"

void OutputCodeWord(StructCodingPara * Ptr)
{
Expand Down
26 changes: 2 additions & 24 deletions olaf/bpe/source/bpe_decoder.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,8 @@ Nov. 3, 2006
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include "global.h"
#include "main_pybind.h"


extern void AdjustOutPut(StructCodingPara * PtrCoding, BitPlaneBits * BlockCodingInfo);

extern void CoeffDegroup(int **img_wav, int rows, int cols);

extern void CoeffDegroupFloating(float **img_wav, int rows, int cols);

extern void HeaderReadin(StructCodingPara *PtrCoding);

extern void DWT_Reverse(int **block, StructCodingPara *PtrCoding);

extern void DWT_ReverseFloating(float **block,
StructCodingPara *PtrCoding);

extern short DCDeCoding(StructCodingPara *PtrCoding,
StructFreBlockString * ,
BitPlaneBits *BlockInfo);


extern void ACBpeDecoding(StructCodingPara *PtrCoding,
BitPlaneBits *BlockCodingInfo);
#include "global.h"
//#include "main_pybind.h"


short ImageWrite(StructCodingPara *StrPtr, int **image);
Expand Down
13 changes: 2 additions & 11 deletions olaf/bpe/source/bpe_encoder.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,14 @@ Nov. 3, 2006
#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>
//#include "global.h"
#include "main_pybind.h"
#include "global.h"
//#include "main_pybind.h"

extern void DWT_(StructCodingPara *, int **, int **);

extern void HeaderUpdate(HeaderStruct * );

extern void DCEncoding(StructCodingPara *, long **, BitPlaneBits *);

extern void ACBpeEncoding(StructCodingPara *, BitPlaneBits *);

int ImageSize(StructCodingPara * );

short ImageRead(StructCodingPara *, int **);

extern void DebugInfo(char *m);

int ImageSize(StructCodingPara * PtrStructCodingPara)
{
/*
Expand Down
4 changes: 0 additions & 4 deletions olaf/bpe/source/bpe_main.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ Modified August 2023 for PSAS

//#define DEMO

extern void EncoderEngine(StructCodingPara * PtrCoding);
extern void DecoderEngine(StructCodingPara * PtrCoding);
extern void HeaderInilization(StructCodingPara *Ptr);
void DebugInfo(char *m);

#define VERSION "Last modified on March 9, 2008\n"
Expand Down Expand Up @@ -92,7 +89,6 @@ BOOL ParameterValidCheck(StructCodingPara *PtrCoding)

int main(int argc, char **argv)
{
extern char *optarg;
char i = 0;
long TotalPixels = 0;
char StringBuffer[100] = {""};
Expand Down
Loading

0 comments on commit 1b2f959

Please sign in to comment.