mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 20:54:07 +00:00
Simple OpenMP parallelization
This commit is contained in:
parent
4b861deacd
commit
7719837f17
|
@ -5,7 +5,7 @@ ifeq (, $(ARCH))
|
||||||
endif
|
endif
|
||||||
SYSTEM = $(shell uname -s)
|
SYSTEM = $(shell uname -s)
|
||||||
ASMFLAGS =
|
ASMFLAGS =
|
||||||
DFLAGS = -O2 -g -Werror
|
DFLAGS = -O2 -g -Werror -DUSE_TILES=1
|
||||||
|
|
||||||
# ARCH related flags
|
# ARCH related flags
|
||||||
ifeq ($(ARCH), x86_64)
|
ifeq ($(ARCH), x86_64)
|
||||||
|
@ -44,10 +44,10 @@ else
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc -fopenmp
|
||||||
CCFLAGS = $(DFLAGS) -I. -I/usr/local/include -L/usr/local/lib -Wall
|
CCFLAGS = $(DFLAGS) -I. -I/usr/local/include -L/usr/local/lib -Wall
|
||||||
LDFLAGS += -lm
|
LDFLAGS += -lm
|
||||||
LD = gcc
|
LD = gcc -fopenmp
|
||||||
YASM = yasm
|
YASM = yasm
|
||||||
ASMOBJS = cpu.o
|
ASMOBJS = cpu.o
|
||||||
OBJS = interface_main.o encmain.o bitstream.o cabac.o config.o context.o encoder.o filter.o inter.o intra.o nal.o picture.o rdo.o sao.o scalinglist.o search.o tables.o transform.o extras/getopt.o
|
OBJS = interface_main.o encmain.o bitstream.o cabac.o config.o context.o encoder.o filter.o inter.o intra.o nal.o picture.o rdo.o sao.o scalinglist.o search.o tables.o transform.o extras/getopt.o
|
||||||
|
|
|
@ -715,8 +715,9 @@ void encode_one_frame(encoder_state * const encoder_state)
|
||||||
|
|
||||||
if (USE_TILES && encoder->tiles_enable) {
|
if (USE_TILES && encoder->tiles_enable) {
|
||||||
#if USE_TILES
|
#if USE_TILES
|
||||||
int i,x,y;
|
int x,y;
|
||||||
//This can be parallelized
|
//This can be parallelized
|
||||||
|
#pragma omp parallel for private(x,y) collapse(2)
|
||||||
for (y=0; y < encoder->tiles_num_tile_rows; ++y) {
|
for (y=0; y < encoder->tiles_num_tile_rows; ++y) {
|
||||||
for (x=0; x < encoder->tiles_num_tile_columns; ++x) {
|
for (x=0; x < encoder->tiles_num_tile_columns; ++x) {
|
||||||
const int tile_width_in_lcu = encoder->tiles_col_bd[x+1]-encoder->tiles_col_bd[x];
|
const int tile_width_in_lcu = encoder->tiles_col_bd[x+1]-encoder->tiles_col_bd[x];
|
||||||
|
@ -727,7 +728,7 @@ void encode_one_frame(encoder_state * const encoder_state)
|
||||||
const int tile_height = MIN(tile_height_in_lcu * LCU_WIDTH, encoder->in.height - tile_offset_y);
|
const int tile_height = MIN(tile_height_in_lcu * LCU_WIDTH, encoder->in.height - tile_offset_y);
|
||||||
const int tile_offset_full = tile_offset_x+tile_offset_y*encoder_state->cur_pic->width;
|
const int tile_offset_full = tile_offset_x+tile_offset_y*encoder_state->cur_pic->width;
|
||||||
const int tile_offset_half = tile_offset_x/2+tile_offset_y/2*encoder_state->cur_pic->width/2;
|
const int tile_offset_half = tile_offset_x/2+tile_offset_y/2*encoder_state->cur_pic->width/2;
|
||||||
i = y * encoder->tiles_num_tile_columns + x;
|
const int i = y * encoder->tiles_num_tile_columns + x;
|
||||||
|
|
||||||
//TODO: ref frames
|
//TODO: ref frames
|
||||||
|
|
||||||
|
@ -751,7 +752,7 @@ void encode_one_frame(encoder_state * const encoder_state)
|
||||||
//This has to be serial
|
//This has to be serial
|
||||||
for (y=0; y < encoder->tiles_num_tile_rows; ++y) {
|
for (y=0; y < encoder->tiles_num_tile_rows; ++y) {
|
||||||
for (x=0; x < encoder->tiles_num_tile_columns; ++x) {
|
for (x=0; x < encoder->tiles_num_tile_columns; ++x) {
|
||||||
i = y * encoder->tiles_num_tile_columns + x;
|
const int i = y * encoder->tiles_num_tile_columns + x;
|
||||||
|
|
||||||
if (x == (encoder->tiles_num_tile_columns-1) && y == (encoder->tiles_num_tile_rows-1)) {
|
if (x == (encoder->tiles_num_tile_columns-1) && y == (encoder->tiles_num_tile_rows-1)) {
|
||||||
//Last tile
|
//Last tile
|
||||||
|
|
Loading…
Reference in a new issue