mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
Rename yuv_input module to yuv_io.
This commit is contained in:
parent
1f41717351
commit
7bd23f5dbb
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1,6 +1,10 @@
|
|||
# Build files
|
||||
/bin
|
||||
/build
|
||||
/build/*
|
||||
!/build/kvazaar_lib
|
||||
/build/kvazaar_lib/*
|
||||
!/build/kvazaar_lib/kvazaar_lib.vcxproj
|
||||
!/build/kvazaar_lib/kvazaar_lib.vcxproj.filters
|
||||
/scons_build_*
|
||||
|
||||
# Generated documentation
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
<ClCompile Include="..\..\src\sao.c" />
|
||||
<ClCompile Include="..\..\src\scalinglist.c" />
|
||||
<ClCompile Include="..\..\src\search.c" />
|
||||
<ClCompile Include="..\..\src\yuv_input.c" />
|
||||
<ClCompile Include="..\..\src\yuv_io.c" />
|
||||
<ClInclude Include="..\..\src\checkpoint.h" />
|
||||
<ClInclude Include="..\..\src\cli.h" />
|
||||
<ClInclude Include="..\..\src\cu.h" />
|
||||
|
@ -194,6 +194,7 @@
|
|||
<ClCompile Include="..\..\src\tables.c" />
|
||||
<ClCompile Include="..\..\src\threadqueue.c" />
|
||||
<ClCompile Include="..\..\src\transform.c" />
|
||||
<ClInclude Include="..\..\src\yuv_io.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\bitstream.h" />
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
<ClCompile Include="..\..\src\rate_control.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\yuv_input.c">
|
||||
<ClCompile Include="..\..\src\yuv_io.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -350,6 +350,9 @@
|
|||
<ClInclude Include="..\..\src\rate_control.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\yuv_io.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<YASM Include="..\..\src\extras\x86inc.asm">
|
||||
|
|
|
@ -107,7 +107,7 @@ OBJS = \
|
|||
encoder_state-geometry.o \
|
||||
image.o \
|
||||
videoframe.o \
|
||||
yuv_input.o \
|
||||
yuv_io.o \
|
||||
strategies/strategies-picture.o \
|
||||
strategies/strategies-nal.o \
|
||||
strategies/strategies-dct.o \
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "image.h"
|
||||
#include "cli.h"
|
||||
#include "kvazaar.h"
|
||||
#include "yuv_input.h"
|
||||
#include "yuv_io.h"
|
||||
|
||||
/**
|
||||
* \brief Open a file for reading.
|
||||
|
@ -160,7 +160,7 @@ int main(int argc, char *argv[])
|
|||
encoder->in.width, encoder->in.height,
|
||||
encoder->in.real_width, encoder->in.real_height);
|
||||
|
||||
if (cfg->seek > 0 && !yuv_input_seek(input, cfg->seek, cfg->width, cfg->height)) {
|
||||
if (cfg->seek > 0 && !yuv_io_seek(input, cfg->seek, cfg->width, cfg->height)) {
|
||||
fprintf(stderr, "Failed to seek %d frames.\n", cfg->seek);
|
||||
goto exit_failure;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "sao.h"
|
||||
#include "rdo.h"
|
||||
#include "rate_control.h"
|
||||
#include "yuv_input.h"
|
||||
#include "yuv_io.h"
|
||||
|
||||
int encoder_state_match_children_of_previous_frame(encoder_state_t * const state) {
|
||||
int i;
|
||||
|
@ -898,7 +898,7 @@ int read_one_frame(FILE* file, const encoder_state_t * const state, image_t *img
|
|||
}
|
||||
else return 0;
|
||||
}
|
||||
if (!yuv_input_read(file, width, height, array_width, array_height, gop_pictures[i].source)) {
|
||||
if (!yuv_io_read(file, width, height, gop_pictures[i].source)) {
|
||||
if (gop_pictures_available) {
|
||||
gop_skip_frames = state->encoder_control->cfg->gop_len - gop_pictures_available;
|
||||
break;
|
||||
|
@ -928,7 +928,7 @@ int read_one_frame(FILE* file, const encoder_state_t * const state, image_t *img
|
|||
memcpy(img_out->v, gop_pictures[cur_gop].source->v, (width >> 1) * (height >> 1));
|
||||
gop_pictures_available--;
|
||||
} else {
|
||||
return yuv_input_read(file, width, height, array_width, array_height, img_out);
|
||||
return yuv_io_read(file, width, height, img_out);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "yuv_input.h"
|
||||
#include "yuv_io.h"
|
||||
|
||||
static void fill_after_frame(unsigned height, unsigned array_width,
|
||||
unsigned array_height, pixel_t *data)
|
||||
|
@ -77,26 +77,23 @@ static int read_and_fill_frame_data(FILE *file,
|
|||
* \param file input file
|
||||
* \param input_width width of the input video in pixels
|
||||
* \param input_height height of the input video in pixels
|
||||
* \param array_width width of the image buffer in pixels
|
||||
* \param array_height height of the image buffer in pixels
|
||||
* \param img_out image buffer
|
||||
*
|
||||
* \return 1 on success, 0 on failure
|
||||
*/
|
||||
int yuv_input_read(FILE* file,
|
||||
unsigned input_width, unsigned input_height,
|
||||
unsigned array_width, unsigned array_height,
|
||||
image_t *img_out)
|
||||
int yuv_io_read(FILE* file,
|
||||
unsigned input_width, unsigned input_height,
|
||||
image_t *img_out)
|
||||
{
|
||||
const unsigned y_size = input_width * input_height;
|
||||
const unsigned uv_input_width = input_width / 2;
|
||||
const unsigned uv_input_height = input_height / 2;
|
||||
const unsigned uv_size = uv_input_width * uv_input_height;
|
||||
|
||||
const unsigned uv_array_width = array_width / 2;
|
||||
const unsigned uv_array_height = array_height / 2;
|
||||
const unsigned uv_array_width = img_out->width / 2;
|
||||
const unsigned uv_array_height = img_out->height / 2;
|
||||
|
||||
if (input_width == array_width) {
|
||||
if (input_width == img_out->width) {
|
||||
// No need to extend pixels.
|
||||
const size_t pixel_size = sizeof(unsigned char);
|
||||
if (fread(img_out->y, pixel_size, y_size, file) != y_size) return 0;
|
||||
|
@ -104,14 +101,14 @@ int yuv_input_read(FILE* file,
|
|||
if (fread(img_out->v, pixel_size, uv_size, file) != uv_size) return 0;
|
||||
} else {
|
||||
// Need to copy pixels to fill the image in horizontal direction.
|
||||
if (!read_and_fill_frame_data(file, input_width, input_height, array_width, img_out->y)) return 0;
|
||||
if (!read_and_fill_frame_data(file, input_width, input_height, img_out->width, img_out->y)) return 0;
|
||||
if (!read_and_fill_frame_data(file, uv_input_width, uv_input_height, uv_array_width, img_out->u)) return 0;
|
||||
if (!read_and_fill_frame_data(file, uv_input_width, uv_input_height, uv_array_width, img_out->v)) return 0;
|
||||
}
|
||||
|
||||
if (input_height != array_height) {
|
||||
if (input_height != img_out->height) {
|
||||
// Need to copy pixels to fill the image in vertical direction.
|
||||
fill_after_frame(input_height, array_width, array_height, img_out->y);
|
||||
fill_after_frame(input_height, img_out->width, img_out->height, img_out->y);
|
||||
fill_after_frame(uv_input_height, uv_array_width, uv_array_height, img_out->u);
|
||||
fill_after_frame(uv_input_height, uv_array_width, uv_array_height, img_out->v);
|
||||
}
|
||||
|
@ -121,7 +118,7 @@ int yuv_input_read(FILE* file,
|
|||
|
||||
|
||||
/**
|
||||
* \brief Seek forward in a YUV input file.
|
||||
* \brief Seek forward in a YUV file.
|
||||
*
|
||||
* \param file the input file
|
||||
* \param frames number of frames to seek
|
||||
|
@ -130,8 +127,8 @@ int yuv_input_read(FILE* file,
|
|||
*
|
||||
* \return 1 on success, 0 on failure
|
||||
*/
|
||||
int yuv_input_seek(FILE* file, unsigned frames,
|
||||
unsigned input_width, unsigned input_height)
|
||||
int yuv_io_seek(FILE* file, unsigned frames,
|
||||
unsigned input_width, unsigned input_height)
|
||||
{
|
||||
const size_t frame_bytes = input_width * input_height * 3 / 2;
|
||||
const size_t skip_bytes = frames * frame_bytes;
|
|
@ -18,22 +18,21 @@
|
|||
* with Kvazaar. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef YUV_INPUT_H_
|
||||
#define YUV_INPUT_H_
|
||||
#ifndef YUV_IO_H_
|
||||
#define YUV_IO_H_
|
||||
|
||||
/*
|
||||
* \file
|
||||
* \brief Functions related to reading YUV input.
|
||||
* \brief Functions related to reading YUV input and output.
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
|
||||
int yuv_input_read(FILE* file,
|
||||
unsigned input_width, unsigned input_height,
|
||||
unsigned array_width, unsigned array_height,
|
||||
image_t *img_out);
|
||||
int yuv_io_read(FILE* file,
|
||||
unsigned input_width, unsigned input_height,
|
||||
image_t *img_out);
|
||||
|
||||
int yuv_input_seek(FILE* file, unsigned frames,
|
||||
unsigned input_width, unsigned input_height);
|
||||
int yuv_io_seek(FILE* file, unsigned frames,
|
||||
unsigned input_width, unsigned input_height);
|
||||
|
||||
#endif // YUV_INPUT_H_
|
||||
#endif // YUV_IO_H_
|
Loading…
Reference in a new issue