Commit 5fce29ef authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '2db953f8'

* commit '2db953f8':
  h264: K&R formatting cosmetics

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_direct.c
	libavcodec/h264_slice.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents b884599f 2db953f8
......@@ -526,8 +526,10 @@ int ff_h264_context_init(H264Context *h)
er->mb_stride = h->mb_stride;
er->b8_stride = h->mb_width * 2 + 1;
FF_ALLOCZ_OR_GOTO(h->avctx, er->mb_index2xy, (h->mb_num + 1) * sizeof(int),
fail); // error ressilience code looks cleaner with this
// error resilience code looks cleaner with this
FF_ALLOCZ_OR_GOTO(h->avctx, er->mb_index2xy,
(h->mb_num + 1) * sizeof(int), fail);
for (y = 0; y < h->mb_height; y++)
for (x = 0; x < h->mb_width; x++)
er->mb_index2xy[x + y * h->mb_width] = x + y * h->mb_stride;
......@@ -543,10 +545,11 @@ int ff_h264_context_init(H264Context *h)
FF_ALLOCZ_OR_GOTO(h->avctx, er->mbskip_table, mb_array_size + 2, fail);
FF_ALLOC_OR_GOTO(h->avctx, er->er_temp_buffer, h->mb_height * h->mb_stride,
fail);
FF_ALLOC_OR_GOTO(h->avctx, er->er_temp_buffer,
h->mb_height * h->mb_stride, fail);
FF_ALLOCZ_OR_GOTO(h->avctx, h->dc_val_base, yc_size * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(h->avctx, h->dc_val_base,
yc_size * sizeof(int16_t), fail);
er->dc_val[0] = h->dc_val_base + h->mb_width * 2 + 2;
er->dc_val[1] = h->dc_val_base + y_size + h->mb_stride + 1;
er->dc_val[2] = er->dc_val[1] + c_size;
......@@ -614,7 +617,7 @@ int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size)
}
p += nalsize;
}
// Now store right nal length size, that will be used to parse all other nals
// Store right nal length size that will be used to parse all other nals
h->nal_length_size = (buf[4] & 0x03) + 1;
} else {
h->is_avc = 0;
......@@ -1049,7 +1052,7 @@ static void idr(H264Context *h)
{
int i;
ff_h264_remove_all_refs(h);
h->prev_frame_num = 0;
h->prev_frame_num =
h->prev_frame_num_offset = 0;
h->prev_poc_msb = 1<<16;
h->prev_poc_lsb = 0;
......@@ -1783,9 +1786,9 @@ end:
static int get_consumed_bytes(int pos, int buf_size)
{
if (pos == 0)
pos = 1; // avoid infinite loops (i doubt that is needed but ...)
pos = 1; // avoid infinite loops (I doubt that is needed but...)
if (pos + 10 > buf_size)
pos = buf_size; // oops ;)
pos = buf_size; // oops ;)
return pos;
}
......
This diff is collapsed.
......@@ -230,9 +230,9 @@ static int init_table_pools(H264Context *h)
av_buffer_allocz);
h->mb_type_pool = av_buffer_pool_init((big_mb_num + h->mb_stride) *
sizeof(uint32_t), av_buffer_allocz);
h->motion_val_pool = av_buffer_pool_init(2 * (b4_array_size + 4) *
sizeof(int16_t), av_buffer_allocz);
h->ref_index_pool = av_buffer_pool_init(4 * mb_array_size, av_buffer_allocz);
h->motion_val_pool = av_buffer_pool_init(2 * (b4_array_size + 4) *
sizeof(int16_t), av_buffer_allocz);
h->ref_index_pool = av_buffer_pool_init(4 * mb_array_size, av_buffer_allocz);
if (!h->qscale_table_pool || !h->mb_type_pool || !h->motion_val_pool ||
!h->ref_index_pool) {
......@@ -1128,7 +1128,10 @@ static int init_dimensions(H264Context *h)
return AVERROR_INVALIDDATA;
av_log(h->avctx, AV_LOG_WARNING, "Ignoring cropping information.\n");
h->sps.crop_bottom = h->sps.crop_top = h->sps.crop_right = h->sps.crop_left = 0;
h->sps.crop_bottom =
h->sps.crop_top =
h->sps.crop_right =
h->sps.crop_left =
h->sps.crop = 0;
width = h->width;
......@@ -2491,14 +2494,12 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
if ( get_bits_left(&h->gb) == 0
|| get_bits_left(&h->gb) > 0 && !(h->avctx->err_recognition & AV_EF_AGGRESSIVE)) {
er_add_slice(h, h->resync_mb_x, h->resync_mb_y,
h->mb_x - 1, h->mb_y,
ER_MB_END);
h->mb_x - 1, h->mb_y, ER_MB_END);
return 0;
} else {
er_add_slice(h, h->resync_mb_x, h->resync_mb_y,
h->mb_x, h->mb_y,
ER_MB_END);
h->mb_x, h->mb_y, ER_MB_END);
return AVERROR_INVALIDDATA;
}
......@@ -2511,8 +2512,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg)
if (get_bits_left(&h->gb) == 0) {
er_add_slice(h, h->resync_mb_x, h->resync_mb_y,
h->mb_x - 1, h->mb_y,
ER_MB_END);
h->mb_x - 1, h->mb_y, ER_MB_END);
if (h->mb_x > lf_x_start)
loop_filter(h, lf_x_start, h->mb_x);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment