mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-12-03 13:44:05 +00:00
Added some encoder control structures
This commit is contained in:
parent
bbe03211e1
commit
8507aa0c9a
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
/bin
|
||||||
|
/build
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*! \file bitstream.c
|
||||||
|
\brief Bitstream related functions
|
||||||
|
\author Marko Viitanen
|
||||||
|
\date 2012-05
|
||||||
|
|
||||||
|
This file has all bitstream functions
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -7,21 +15,17 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "bitstream.h"
|
#include "bitstream.h"
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
void printf_bitstream(char *msg, ...)
|
void printf_bitstream(char *msg, ...)
|
||||||
{
|
{
|
||||||
|
va_list fmtargs;
|
||||||
va_list fmtargs;
|
char buffer[1024];
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
va_start(fmtargs,msg);
|
va_start(fmtargs,msg);
|
||||||
vsnprintf(buffer,sizeof(buffer)-1,msg,fmtargs);
|
vsnprintf(buffer,sizeof(buffer)-1,msg,fmtargs);
|
||||||
va_end(fmtargs);
|
va_end(fmtargs);
|
||||||
printf("%s",buffer);
|
printf("%s",buffer);
|
||||||
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear bitstream
|
* Clear bitstream
|
||||||
*/
|
*/
|
||||||
|
@ -46,6 +50,7 @@ void bitstream_put(bitstream* stream, uint32_t data, uint8_t bits)
|
||||||
{
|
{
|
||||||
uint8_t i=0;
|
uint8_t i=0;
|
||||||
uint32_t bitsleft=32-stream->cur_bit;
|
uint32_t bitsleft=32-stream->cur_bit;
|
||||||
|
#ifdef VERBOSE
|
||||||
printf_bitstream("put: ");
|
printf_bitstream("put: ");
|
||||||
for(i=0;i<bits;i++)
|
for(i=0;i<bits;i++)
|
||||||
{
|
{
|
||||||
|
@ -53,6 +58,7 @@ void bitstream_put(bitstream* stream, uint32_t data, uint8_t bits)
|
||||||
}
|
}
|
||||||
printf_bitstream("\n");
|
printf_bitstream("\n");
|
||||||
//printf_bitstream(" count: %i\n",bits);
|
//printf_bitstream(" count: %i\n",bits);
|
||||||
|
#endif
|
||||||
|
|
||||||
//Theres space for all the bits
|
//Theres space for all the bits
|
||||||
if(bits<=bitsleft)
|
if(bits<=bitsleft)
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/*! \file bitstream.h
|
||||||
|
\brief Bitstream related functions
|
||||||
|
\author Marko Viitanen
|
||||||
|
\date 2012-05
|
||||||
|
|
||||||
|
This file has all bitstream headers
|
||||||
|
*/
|
||||||
#ifndef _BITSTREAM_H
|
#ifndef _BITSTREAM_H
|
||||||
#define _BITSTREAM_H
|
#define _BITSTREAM_H
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "encoder.h"
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -54,6 +55,7 @@
|
||||||
config *cfg = NULL; /* Global configuration */
|
config *cfg = NULL; /* Global configuration */
|
||||||
FILE *input = NULL;
|
FILE *input = NULL;
|
||||||
FILE *output = NULL;
|
FILE *output = NULL;
|
||||||
|
encoder_control* encoder;
|
||||||
|
|
||||||
/* Handle configuration */
|
/* Handle configuration */
|
||||||
cfg = config_alloc();
|
cfg = config_alloc();
|
||||||
|
@ -77,6 +79,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Input: %s, output: %s\r\n", cfg->input, cfg->output);
|
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 */
|
/* Open input file and check that it was opened correctly */
|
||||||
input = fopen(cfg->input, "rb");
|
input = fopen(cfg->input, "rb");
|
||||||
|
|
0
src/encoder.c
Normal file
0
src/encoder.c
Normal file
35
src/encoder.h
Normal file
35
src/encoder.h
Normal file
|
@ -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
|
Loading…
Reference in a new issue