From 8507aa0c9ae29914b5ca421325bc0c9d91fdf270 Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Fri, 1 Jun 2012 15:31:06 +0300 Subject: [PATCH] Added some encoder control structures --- .gitignore | 3 +++ src/bitstream.c | 28 +++++++++++++++++----------- src/bitstream.h | 7 +++++++ src/encmain.c | 3 +++ src/encoder.c | 0 src/encoder.h | 35 +++++++++++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 .gitignore create mode 100644 src/encoder.c create mode 100644 src/encoder.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..01d7a658 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ + +/bin +/build \ No newline at end of file diff --git a/src/bitstream.c b/src/bitstream.c index 067e1674..407199b2 100644 --- a/src/bitstream.c +++ b/src/bitstream.c @@ -1,3 +1,11 @@ +/*! \file bitstream.c + \brief Bitstream related functions + \author Marko Viitanen + \date 2012-05 + + This file has all bitstream functions +*/ + #include #include #include @@ -7,21 +15,17 @@ #include "global.h" #include "bitstream.h" - +#ifdef VERBOSE void printf_bitstream(char *msg, ...) -{ - -va_list fmtargs; -char buffer[1024]; - +{ + va_list fmtargs; + char buffer[1024]; va_start(fmtargs,msg); vsnprintf(buffer,sizeof(buffer)-1,msg,fmtargs); va_end(fmtargs); - printf("%s",buffer); - -} - - + printf("%s",buffer); +} +#endif /* * Clear bitstream */ @@ -46,6 +50,7 @@ void bitstream_put(bitstream* stream, uint32_t data, uint8_t bits) { uint8_t i=0; uint32_t bitsleft=32-stream->cur_bit; + #ifdef VERBOSE printf_bitstream("put: "); for(i=0;i #include "global.h" #include "config.h" + #include "encoder.h" /*! @@ -54,6 +55,7 @@ config *cfg = NULL; /* Global configuration */ FILE *input = NULL; FILE *output = NULL; + encoder_control* encoder; /* Handle configuration */ cfg = config_alloc(); @@ -77,6 +79,7 @@ } printf("Input: %s, output: %s\r\n", cfg->input, cfg->output); + printf(" Video size: %dx%d\r\n", cfg->width, cfg->height); /* Open input file and check that it was opened correctly */ input = fopen(cfg->input, "rb"); diff --git a/src/encoder.c b/src/encoder.c new file mode 100644 index 00000000..e69de29b diff --git a/src/encoder.h b/src/encoder.h new file mode 100644 index 00000000..a50d1182 --- /dev/null +++ b/src/encoder.h @@ -0,0 +1,35 @@ +/*! \file encoder.h + \brief Encoding related functions + \author Marko Viitanen + \date 2012-06 + + Structures for encoding +*/ +#ifndef _ENCODER_H +#define _ENCODER_H + + +typedef struct +{ + void (*IME)(encoder_control* encoder); + +} encoder_me; + + +typedef struct +{ + FILE *file; + + +} encoder_input; + +typedef struct +{ + encoder_input in; + encoder_me me; + FILE *output; +} encoder_control; + + + +#endif \ No newline at end of file