nhwcodec icon indicating copy to clipboard operation
nhwcodec copied to clipboard

Separate CLI from library

Open tansy opened this issue 3 years ago • 1 comments

I want to suggets some changes in this program. It shouldd work as a client to the "server", a library, which provides routines to en/decode image/s. Main CLI (Command Line Interface) would be a simple program that would only deal with reading/writing files and processing arguments and processing images would be done by library, (more or less as it is in nhw-encoder) preferably in memory, and cli-client would only call necessary routines. Check BALZ source and crush, and libcrush to see what I mean.

First - command line interface: use input and output instaead of automatic naming.

$ nhw-dec <file.nhw> <file.bmp>

You don't know what user wants and don't want to be smarter than them. They know what they do.

decode_image() and parse_file to use string instead od argv**.

decode_image(): instead of decode_image(image_buffer *im,decode_state *os,char *file_name) it should rather go like this: decode_image(decode_state *os, image_buffer *im) and there would be write_image(decode_state *os, image_buffer *im, char* file_name)

Process image in memory, and share state/context structure beteen functions. Have designated functions to read/write from file to/from memory rather than doing hundreds of disk reads/writes (with fread/fwrite). For reference check crush and libcrush linked above.

tansy avatar Nov 18 '22 22:11 tansy

It would be better if all quality options were unified (proposed in #9) and all these parameters wvlt_thrxX put in the table and filled accordingly to the quality parameter.

tansy avatar Nov 19 '22 19:11 tansy