mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-09-21 05:46:55 +00:00
dnxhdenc: whitespace cosmetics
Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
parent
eedb1f2034
commit
1073823984
@ -52,10 +52,10 @@ static av_always_inline void dnxhd_get_pixels_8x4(DCTELEM *restrict block, const
|
|||||||
pixels += line_size;
|
pixels += line_size;
|
||||||
block += 8;
|
block += 8;
|
||||||
}
|
}
|
||||||
memcpy(block , block- 8, sizeof(*block)*8);
|
memcpy(block, block - 8, sizeof(*block) * 8);
|
||||||
memcpy(block+ 8, block-16, sizeof(*block)*8);
|
memcpy(block + 8, block - 16, sizeof(*block) * 8);
|
||||||
memcpy(block+16, block-24, sizeof(*block)*8);
|
memcpy(block + 16, block - 24, sizeof(*block) * 8);
|
||||||
memcpy(block+24, block-32, sizeof(*block)*8);
|
memcpy(block + 24, block - 32, sizeof(*block) * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dnxhd_init_vlc(DNXHDEncContext *ctx)
|
static int dnxhd_init_vlc(DNXHDEncContext *ctx)
|
||||||
@ -64,9 +64,9 @@ static int dnxhd_init_vlc(DNXHDEncContext *ctx)
|
|||||||
int max_level = 1<<(ctx->cid_table->bit_depth+2);
|
int max_level = 1<<(ctx->cid_table->bit_depth+2);
|
||||||
|
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_codes, max_level*4*sizeof(*ctx->vlc_codes), fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_codes, max_level*4*sizeof(*ctx->vlc_codes), fail);
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_bits , max_level*4*sizeof(*ctx->vlc_bits ), fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_bits, max_level*4*sizeof(*ctx->vlc_bits) , fail);
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_codes, 63*2 , fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_codes, 63*2, fail);
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_bits , 63 , fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_bits, 63, fail);
|
||||||
|
|
||||||
ctx->vlc_codes += max_level*2;
|
ctx->vlc_codes += max_level*2;
|
||||||
ctx->vlc_bits += max_level*2;
|
ctx->vlc_bits += max_level*2;
|
||||||
@ -119,8 +119,8 @@ static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
|
|||||||
uint16_t weight_matrix[64] = {1,}; // convert_matrix needs uint16_t*
|
uint16_t weight_matrix[64] = {1,}; // convert_matrix needs uint16_t*
|
||||||
int qscale, i;
|
int qscale, i;
|
||||||
|
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l, (ctx->m.avctx->qmax+1) * 64 * sizeof(int) , fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l, (ctx->m.avctx->qmax+1) * 64 * sizeof(int), fail);
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c, (ctx->m.avctx->qmax+1) * 64 * sizeof(int) , fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c, (ctx->m.avctx->qmax+1) * 64 * sizeof(int), fail);
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t), fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t), fail);
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t), fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t), fail);
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ static int dnxhd_encode_init(AVCodecContext *avctx)
|
|||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->slice_size, ctx->m.mb_height*sizeof(uint32_t), fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->slice_size, ctx->m.mb_height*sizeof(uint32_t), fail);
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->slice_offs, ctx->m.mb_height*sizeof(uint32_t), fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->slice_offs, ctx->m.mb_height*sizeof(uint32_t), fail);
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_bits, ctx->m.mb_num *sizeof(uint16_t), fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_bits, ctx->m.mb_num *sizeof(uint16_t), fail);
|
||||||
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_qscale, ctx->m.mb_num *sizeof(uint8_t) , fail);
|
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_qscale, ctx->m.mb_num *sizeof(uint8_t), fail);
|
||||||
|
|
||||||
ctx->frame.key_frame = 1;
|
ctx->frame.key_frame = 1;
|
||||||
ctx->frame.pict_type = AV_PICTURE_TYPE_I;
|
ctx->frame.pict_type = AV_PICTURE_TYPE_I;
|
||||||
@ -341,7 +341,7 @@ static av_always_inline int dnxhd_ssd_block(DCTELEM *qblock, DCTELEM *block)
|
|||||||
int score = 0;
|
int score = 0;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
||||||
score += (block[i]-qblock[i])*(block[i]-qblock[i]);
|
score += (block[i] - qblock[i]) * (block[i] - qblock[i]);
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,26 +369,28 @@ static av_always_inline void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, in
|
|||||||
const uint8_t *ptr_v = ctx->thread[0]->src[2] + ((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << 3);
|
const uint8_t *ptr_v = ctx->thread[0]->src[2] + ((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << 3);
|
||||||
DSPContext *dsp = &ctx->m.dsp;
|
DSPContext *dsp = &ctx->m.dsp;
|
||||||
|
|
||||||
dsp->get_pixels(ctx->blocks[0], ptr_y , ctx->m.linesize);
|
dsp->get_pixels(ctx->blocks[0], ptr_y, ctx->m.linesize);
|
||||||
dsp->get_pixels(ctx->blocks[1], ptr_y + 8, ctx->m.linesize);
|
dsp->get_pixels(ctx->blocks[1], ptr_y + 8, ctx->m.linesize);
|
||||||
dsp->get_pixels(ctx->blocks[2], ptr_u , ctx->m.uvlinesize);
|
dsp->get_pixels(ctx->blocks[2], ptr_u, ctx->m.uvlinesize);
|
||||||
dsp->get_pixels(ctx->blocks[3], ptr_v , ctx->m.uvlinesize);
|
dsp->get_pixels(ctx->blocks[3], ptr_v, ctx->m.uvlinesize);
|
||||||
|
|
||||||
if (mb_y+1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) {
|
if (mb_y+1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) {
|
||||||
if (ctx->interlaced) {
|
if (ctx->interlaced) {
|
||||||
ctx->get_pixels_8x4_sym(ctx->blocks[4], ptr_y + ctx->dct_y_offset , ctx->m.linesize);
|
ctx->get_pixels_8x4_sym(ctx->blocks[4], ptr_y + ctx->dct_y_offset, ctx->m.linesize);
|
||||||
ctx->get_pixels_8x4_sym(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize);
|
ctx->get_pixels_8x4_sym(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize);
|
||||||
ctx->get_pixels_8x4_sym(ctx->blocks[6], ptr_u + ctx->dct_uv_offset , ctx->m.uvlinesize);
|
ctx->get_pixels_8x4_sym(ctx->blocks[6], ptr_u + ctx->dct_uv_offset, ctx->m.uvlinesize);
|
||||||
ctx->get_pixels_8x4_sym(ctx->blocks[7], ptr_v + ctx->dct_uv_offset , ctx->m.uvlinesize);
|
ctx->get_pixels_8x4_sym(ctx->blocks[7], ptr_v + ctx->dct_uv_offset, ctx->m.uvlinesize);
|
||||||
} else {
|
} else {
|
||||||
dsp->clear_block(ctx->blocks[4]); dsp->clear_block(ctx->blocks[5]);
|
dsp->clear_block(ctx->blocks[4]);
|
||||||
dsp->clear_block(ctx->blocks[6]); dsp->clear_block(ctx->blocks[7]);
|
dsp->clear_block(ctx->blocks[5]);
|
||||||
|
dsp->clear_block(ctx->blocks[6]);
|
||||||
|
dsp->clear_block(ctx->blocks[7]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dsp->get_pixels(ctx->blocks[4], ptr_y + ctx->dct_y_offset , ctx->m.linesize);
|
dsp->get_pixels(ctx->blocks[4], ptr_y + ctx->dct_y_offset, ctx->m.linesize);
|
||||||
dsp->get_pixels(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize);
|
dsp->get_pixels(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize);
|
||||||
dsp->get_pixels(ctx->blocks[6], ptr_u + ctx->dct_uv_offset , ctx->m.uvlinesize);
|
dsp->get_pixels(ctx->blocks[6], ptr_u + ctx->dct_uv_offset, ctx->m.uvlinesize);
|
||||||
dsp->get_pixels(ctx->blocks[7], ptr_v + ctx->dct_uv_offset , ctx->m.uvlinesize);
|
dsp->get_pixels(ctx->blocks[7], ptr_v + ctx->dct_uv_offset, ctx->m.uvlinesize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,14 +498,14 @@ static void dnxhd_setup_threads_slices(DNXHDEncContext *ctx)
|
|||||||
for (mb_y = 0; mb_y < ctx->m.mb_height; mb_y++) {
|
for (mb_y = 0; mb_y < ctx->m.mb_height; mb_y++) {
|
||||||
int thread_size;
|
int thread_size;
|
||||||
ctx->slice_offs[mb_y] = offset;
|
ctx->slice_offs[mb_y] = offset;
|
||||||
ctx->slice_size[mb_y] = 0;
|
ctx->slice_size[mb_y] = 0;
|
||||||
for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) {
|
for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) {
|
||||||
unsigned mb = mb_y * ctx->m.mb_width + mb_x;
|
unsigned mb = mb_y * ctx->m.mb_width + mb_x;
|
||||||
ctx->slice_size[mb_y] += ctx->mb_bits[mb];
|
ctx->slice_size[mb_y] += ctx->mb_bits[mb];
|
||||||
}
|
}
|
||||||
ctx->slice_size[mb_y] = (ctx->slice_size[mb_y]+31)&~31;
|
ctx->slice_size[mb_y] = (ctx->slice_size[mb_y]+31)&~31;
|
||||||
ctx->slice_size[mb_y] >>= 3;
|
ctx->slice_size[mb_y] >>= 3;
|
||||||
thread_size = ctx->slice_size[mb_y];
|
thread_size = ctx->slice_size[mb_y];
|
||||||
offset += thread_size;
|
offset += thread_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user