1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

mimic: cosmetics, reformat

This commit is contained in:
Anton Khirnov 2012-12-26 10:11:12 +01:00
parent 04e1249609
commit a0cabd0a27

View File

@ -131,7 +131,8 @@ static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCod
{
MimicContext *dst = avctx->priv_data, *src = avctx_from->priv_data;
if (avctx == avctx_from) return 0;
if (avctx == avctx_from)
return 0;
dst->cur_index = src->next_cur_index;
dst->prev_index = src->next_prev_index;
@ -232,25 +233,23 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
for (plane = 0; plane < 3; plane++) {
const int is_chroma = !!plane;
const int qscale = av_clip(10000-quality,is_chroma?1000:2000,10000)<<2;
const int qscale = av_clip(10000 - quality, is_chroma ? 1000 : 2000,
10000) << 2;
const int stride = ctx->flipped_ptrs[ctx->cur_index ].linesize[plane];
const uint8_t *src = ctx->flipped_ptrs[ctx->prev_index].data[plane];
uint8_t *dst = ctx->flipped_ptrs[ctx->cur_index ].data[plane];
for (y = 0; y < ctx->num_vblocks[plane]; y++) {
for (x = 0; x < ctx->num_hblocks[plane]; x++) {
/* Check for a change condition in the current block.
* - iframes always change.
* - Luma plane changes on get_bits1 == 0
* - Chroma planes change on get_bits1 == 1 */
if (is_iframe || get_bits1(&ctx->gb) == is_chroma) {
/* Luma planes may use a backreference from the 15 last
* frames preceding the previous. (get_bits1 == 1)
* Chroma planes don't use backreferences. */
if (is_chroma || is_iframe || !get_bits1(&ctx->gb)) {
if (!vlc_decode_block(ctx, num_coeffs, qscale))
return 0;
ctx->dsp.idct_put(dst, stride, ctx->dct_block);
@ -260,7 +259,8 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
uint8_t *p = ctx->flipped_ptrs[index].data[0];
if (index != ctx->cur_index && p) {
ff_thread_await_progress(&ctx->buf_ptrs[index], cur_row, 0);
ff_thread_await_progress(&ctx->buf_ptrs[index],
cur_row, 0);
p += src -
ctx->flipped_ptrs[ctx->prev_index].data[plane];
ctx->dsp.put_pixels_tab[1][0](dst, p, stride, 8);
@ -270,7 +270,8 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
}
}
} else {
ff_thread_await_progress(&ctx->buf_ptrs[ctx->prev_index], cur_row, 0);
ff_thread_await_progress(&ctx->buf_ptrs[ctx->prev_index],
cur_row, 0);
ctx->dsp.put_pixels_tab[1][0](dst, src, stride, 8);
}
src += 8;
@ -279,7 +280,8 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs,
src += (stride - ctx->num_hblocks[plane]) << 3;
dst += (stride - ctx->num_hblocks[plane]) << 3;
ff_thread_report_progress(&ctx->buf_ptrs[ctx->cur_index], cur_row++, 0);
ff_thread_report_progress(&ctx->buf_ptrs[ctx->cur_index],
cur_row++, 0);
}
}
@ -305,12 +307,12 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int swap_buf_size = buf_size - MIMIC_HEADER_SIZE;
MimicContext *ctx = avctx->priv_data;
GetByteContext gb;
int is_pframe;
int width, height;
int quality, num_coeffs;
int swap_buf_size = buf_size - MIMIC_HEADER_SIZE;
int res;
if (buf_size <= MIMIC_HEADER_SIZE) {
@ -356,7 +358,8 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
}
ctx->buf_ptrs[ctx->cur_index].reference = 1;
ctx->buf_ptrs[ctx->cur_index].pict_type = is_pframe ? AV_PICTURE_TYPE_P:AV_PICTURE_TYPE_I;
ctx->buf_ptrs[ctx->cur_index].pict_type = is_pframe ? AV_PICTURE_TYPE_P :
AV_PICTURE_TYPE_I;
if (ff_thread_get_buffer(avctx, &ctx->buf_ptrs[ctx->cur_index])) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;