cosmetics: K&R coding style, prettyprinting

Originally committed as revision 20083 to svn://svn.ffmpeg.org/ffmpeg/trunk
release/0.6
Diego Biurrun 15 years ago
parent 8ea08becfa
commit 8a8720c1bb
  1. 37
      libavcodec/libx264.c

@ -35,8 +35,7 @@ typedef struct X264Context {
AVFrame out_pic;
} X264Context;
static void
X264_log(void *p, int level, const char *fmt, va_list args)
static void X264_log(void *p, int level, const char *fmt, va_list args)
{
static const int level_map[] = {
[X264_LOG_ERROR] = AV_LOG_ERROR,
@ -52,7 +51,8 @@ X264_log(void *p, int level, const char *fmt, va_list args)
}
static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size, x264_nal_t *nals, int nnal, int skip_sei)
static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size,
x264_nal_t *nals, int nnal, int skip_sei)
{
X264Context *x4 = ctx->priv_data;
uint8_t *p = buf;
@ -80,8 +80,8 @@ static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size, x264_nal_t *
return p - buf;
}
static int
X264_frame(AVCodecContext *ctx, uint8_t *buf, int bufsize, void *data)
static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
int bufsize, void *data)
{
X264Context *x4 = ctx->priv_data;
AVFrame *frame = data;
@ -132,8 +132,7 @@ X264_frame(AVCodecContext *ctx, uint8_t *buf, int bufsize, void *data)
return bufsize;
}
static av_cold int
X264_close(AVCodecContext *avctx)
static av_cold int X264_close(AVCodecContext *avctx)
{
X264Context *x4 = avctx->priv_data;
@ -146,8 +145,7 @@ X264_close(AVCodecContext *avctx)
return 0;
}
static av_cold int
X264_init(AVCodecContext *avctx)
static av_cold int X264_init(AVCodecContext *avctx)
{
X264Context *x4 = avctx->priv_data;
@ -162,8 +160,9 @@ X264_init(AVCodecContext *avctx)
x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000;
x4->params.rc.b_stat_write = avctx->flags & CODEC_FLAG_PASS1;
if(avctx->flags & CODEC_FLAG_PASS2) x4->params.rc.b_stat_read = 1;
else{
if (avctx->flags & CODEC_FLAG_PASS2) {
x4->params.rc.b_stat_read = 1;
} else {
if (avctx->crf) {
x4->params.rc.i_rc_method = X264_RC_CRF;
x4->params.rc.f_rf_constant = avctx->crf;
@ -175,7 +174,8 @@ X264_init(AVCodecContext *avctx)
// if neither crf nor cqp modes are selected we have to enable the RC
// we do it this way because we cannot check if the bitrate has been set
if(!(avctx->crf || (avctx->cqp > -1))) x4->params.rc.i_rc_method = X264_RC_ABR;
if (!(avctx->crf || (avctx->cqp > -1)))
x4->params.rc.i_rc_method = X264_RC_ABR;
x4->params.i_bframe = avctx->max_b_frames;
x4->params.b_cabac = avctx->coder_type == FF_CODER_TYPE_AC;
@ -244,8 +244,7 @@ X264_init(AVCodecContext *avctx)
x4->params.analyse.i_me_range = avctx->me_range;
x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality;
x4->params.analyse.b_mixed_references =
avctx->flags2 & CODEC_FLAG2_MIXED_REFS;
x4->params.analyse.b_mixed_references = avctx->flags2 & CODEC_FLAG2_MIXED_REFS;
x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA;
x4->params.analyse.b_transform_8x8 = avctx->flags2 & CODEC_FLAG2_8X8DCT;
x4->params.analyse.b_fast_pskip = avctx->flags2 & CODEC_FLAG2_FASTPSKIP;
@ -253,7 +252,8 @@ X264_init(AVCodecContext *avctx)
x4->params.analyse.i_trellis = avctx->trellis;
x4->params.analyse.i_noise_reduction = avctx->noise_reduction;
if(avctx->level > 0) x4->params.i_level_idc = avctx->level;
if (avctx->level > 0)
x4->params.i_level_idc = avctx->level;
x4->params.rc.f_rate_tolerance =
(float)avctx->bit_rate_tolerance/avctx->bit_rate;
@ -262,8 +262,8 @@ X264_init(AVCodecContext *avctx)
(avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {
x4->params.rc.f_vbv_buffer_init =
(float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
}
else x4->params.rc.f_vbv_buffer_init = 0.9;
} else
x4->params.rc.f_vbv_buffer_init = 0.9;
x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
x4->params.rc.f_pb_factor = avctx->b_quant_factor;
@ -278,9 +278,8 @@ X264_init(AVCodecContext *avctx)
x4->params.b_interlaced = avctx->flags & CODEC_FLAG_INTERLACED_DCT;
if(avctx->flags & CODEC_FLAG_GLOBAL_HEADER){
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
x4->params.b_repeat_headers = 0;
}
x4->enc = x264_encoder_open(&x4->params);
if (!x4->enc)

Loading…
Cancel
Save