You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
rv10: cosmetics, reformat
This commit is contained in:
@ -45,8 +45,7 @@ typedef struct RVDecContext {
|
|||||||
int sub_id;
|
int sub_id;
|
||||||
} RVDecContext;
|
} RVDecContext;
|
||||||
|
|
||||||
static const uint16_t rv_lum_code[256] =
|
static const uint16_t rv_lum_code[256] = {
|
||||||
{
|
|
||||||
0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06,
|
0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06,
|
||||||
0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e,
|
0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e,
|
||||||
0x0f0f, 0x0f10, 0x0f11, 0x0f12, 0x0f13, 0x0f14, 0x0f15, 0x0f16,
|
0x0f0f, 0x0f10, 0x0f11, 0x0f12, 0x0f13, 0x0f14, 0x0f15, 0x0f16,
|
||||||
@ -81,8 +80,7 @@ static const uint16_t rv_lum_code[256] =
|
|||||||
0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f,
|
0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t rv_lum_bits[256] =
|
static const uint8_t rv_lum_bits[256] = {
|
||||||
{
|
|
||||||
14, 12, 12, 12, 12, 12, 12, 12,
|
14, 12, 12, 12, 12, 12, 12, 12,
|
||||||
12, 12, 12, 12, 12, 12, 12, 12,
|
12, 12, 12, 12, 12, 12, 12, 12,
|
||||||
12, 12, 12, 12, 12, 12, 12, 12,
|
12, 12, 12, 12, 12, 12, 12, 12,
|
||||||
@ -117,8 +115,7 @@ static const uint8_t rv_lum_bits[256] =
|
|||||||
12, 12, 12, 12, 12, 12, 12, 12,
|
12, 12, 12, 12, 12, 12, 12, 12,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint16_t rv_chrom_code[256] =
|
static const uint16_t rv_chrom_code[256] = {
|
||||||
{
|
|
||||||
0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06,
|
0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06,
|
||||||
0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e,
|
0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e,
|
||||||
0x3f0f, 0x3f10, 0x3f11, 0x3f12, 0x3f13, 0x3f14, 0x3f15, 0x3f16,
|
0x3f0f, 0x3f10, 0x3f11, 0x3f12, 0x3f13, 0x3f14, 0x3f15, 0x3f16,
|
||||||
@ -153,8 +150,7 @@ static const uint16_t rv_chrom_code[256] =
|
|||||||
0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f,
|
0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t rv_chrom_bits[256] =
|
static const uint8_t rv_chrom_bits[256] = {
|
||||||
{
|
|
||||||
16, 14, 14, 14, 14, 14, 14, 14,
|
16, 14, 14, 14, 14, 14, 14, 14,
|
||||||
14, 14, 14, 14, 14, 14, 14, 14,
|
14, 14, 14, 14, 14, 14, 14, 14,
|
||||||
14, 14, 14, 14, 14, 14, 14, 14,
|
14, 14, 14, 14, 14, 14, 14, 14,
|
||||||
@ -252,7 +248,10 @@ static int rv10_decode_picture_header(MpegEncContext *s)
|
|||||||
s->pict_type = AV_PICTURE_TYPE_P;
|
s->pict_type = AV_PICTURE_TYPE_P;
|
||||||
else
|
else
|
||||||
s->pict_type = AV_PICTURE_TYPE_I;
|
s->pict_type = AV_PICTURE_TYPE_I;
|
||||||
if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n");
|
|
||||||
|
if (!marker)
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "marker missing\n");
|
||||||
|
|
||||||
pb_frame = get_bits1(&s->gb);
|
pb_frame = get_bits1(&s->gb);
|
||||||
|
|
||||||
av_dlog(s->avctx, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);
|
av_dlog(s->avctx, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);
|
||||||
@ -354,7 +353,8 @@ static int rv20_decode_picture_header(RVDecContext *rv)
|
|||||||
new_h = s->orig_height;
|
new_h = s->orig_height;
|
||||||
}
|
}
|
||||||
if (new_w != s->width || new_h != s->height) {
|
if (new_w != s->width || new_h != s->height) {
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h);
|
av_log(s->avctx, AV_LOG_DEBUG,
|
||||||
|
"attempting to change resolution to %dx%d\n", new_w, new_h);
|
||||||
if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0)
|
if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
ff_MPV_common_end(s);
|
ff_MPV_common_end(s);
|
||||||
@ -374,8 +374,11 @@ static int rv20_decode_picture_header(RVDecContext *rv)
|
|||||||
mb_pos = ff_h263_decode_mba(s);
|
mb_pos = ff_h263_decode_mba(s);
|
||||||
|
|
||||||
seq |= s->time & ~0x7FFF;
|
seq |= s->time & ~0x7FFF;
|
||||||
if(seq - s->time > 0x4000) seq -= 0x8000;
|
if (seq - s->time > 0x4000)
|
||||||
if(seq - s->time < -0x4000) seq += 0x8000;
|
seq -= 0x8000;
|
||||||
|
if (seq - s->time < -0x4000)
|
||||||
|
seq += 0x8000;
|
||||||
|
|
||||||
if (seq != s->time) {
|
if (seq != s->time) {
|
||||||
if (s->pict_type != AV_PICTURE_TYPE_B) {
|
if (s->pict_type != AV_PICTURE_TYPE_B) {
|
||||||
s->time = seq;
|
s->time = seq;
|
||||||
@ -384,8 +387,10 @@ static int rv20_decode_picture_header(RVDecContext *rv)
|
|||||||
} else {
|
} else {
|
||||||
s->time = seq;
|
s->time = seq;
|
||||||
s->pb_time = s->pp_time - (s->last_non_b_time - s->time);
|
s->pb_time = s->pp_time - (s->last_non_b_time - s->time);
|
||||||
if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){
|
if (s->pp_time <= s->pb_time ||
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible from seeking? skipping current b frame\n");
|
s->pp_time <= s->pp_time - s->pb_time || s->pp_time <= 0) {
|
||||||
|
av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible "
|
||||||
|
"from seeking? skipping current b frame\n");
|
||||||
return FRAME_SKIPPED;
|
return FRAME_SKIPPED;
|
||||||
}
|
}
|
||||||
ff_mpeg4_init_direct_mv(s);
|
ff_mpeg4_init_direct_mv(s);
|
||||||
@ -400,9 +405,6 @@ static int rv20_decode_picture_header(RVDecContext *rv)
|
|||||||
s->f_code = 1;
|
s->f_code = 1;
|
||||||
s->unrestricted_mv = 1;
|
s->unrestricted_mv = 1;
|
||||||
s->h263_aic = s->pict_type == AV_PICTURE_TYPE_I;
|
s->h263_aic = s->pict_type == AV_PICTURE_TYPE_I;
|
||||||
// s->alt_inter_vlc=1;
|
|
||||||
// s->obmc=1;
|
|
||||||
// s->umvplus=1;
|
|
||||||
s->modified_quant = 1;
|
s->modified_quant = 1;
|
||||||
s->loop_filter = 1;
|
s->loop_filter = 1;
|
||||||
|
|
||||||
@ -464,7 +466,8 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->debug & FF_DEBUG_PICT_INFO) {
|
if (avctx->debug & FF_DEBUG_PICT_INFO) {
|
||||||
av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", rv->sub_id, avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1);
|
av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", rv->sub_id,
|
||||||
|
avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||||
@ -546,7 +549,8 @@ static int rv10_decode_packet(AVCodecContext *avctx,
|
|||||||
|
|
||||||
/* default quantization values */
|
/* default quantization values */
|
||||||
if (s->codec_id == AV_CODEC_ID_RV10) {
|
if (s->codec_id == AV_CODEC_ID_RV10) {
|
||||||
if(s->mb_y==0) s->first_slice_line=1;
|
if (s->mb_y == 0)
|
||||||
|
s->first_slice_line = 1;
|
||||||
} else {
|
} else {
|
||||||
s->first_slice_line = 1;
|
s->first_slice_line = 1;
|
||||||
s->resync_mb_x = s->mb_x;
|
s->resync_mb_x = s->mb_x;
|
||||||
@ -554,11 +558,9 @@ static int rv10_decode_packet(AVCodecContext *avctx,
|
|||||||
start_mb_x = s->mb_x;
|
start_mb_x = s->mb_x;
|
||||||
s->resync_mb_y = s->mb_y;
|
s->resync_mb_y = s->mb_y;
|
||||||
if (s->h263_aic) {
|
if (s->h263_aic) {
|
||||||
s->y_dc_scale_table=
|
s->y_dc_scale_table = s->c_dc_scale_table = ff_aic_dc_scale_table;
|
||||||
s->c_dc_scale_table= ff_aic_dc_scale_table;
|
|
||||||
} else {
|
} else {
|
||||||
s->y_dc_scale_table=
|
s->y_dc_scale_table = s->c_dc_scale_table = ff_mpeg1_dc_scale_table;
|
||||||
s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->modified_quant)
|
if (s->modified_quant)
|
||||||
@ -576,8 +578,8 @@ static int rv10_decode_packet(AVCodecContext *avctx,
|
|||||||
s->block_wrap[4] =
|
s->block_wrap[4] =
|
||||||
s->block_wrap[5] = s->mb_stride;
|
s->block_wrap[5] = s->mb_stride;
|
||||||
ff_init_block_index(s);
|
ff_init_block_index(s);
|
||||||
/* decode each macroblock */
|
|
||||||
|
|
||||||
|
/* decode each macroblock */
|
||||||
for (s->mb_num_left = mb_count; s->mb_num_left > 0; s->mb_num_left--) {
|
for (s->mb_num_left = mb_count; s->mb_num_left > 0; s->mb_num_left--) {
|
||||||
int ret;
|
int ret;
|
||||||
ff_update_block_index(s);
|
ff_update_block_index(s);
|
||||||
@ -623,18 +625,22 @@ static int rv10_decode_packet(AVCodecContext *avctx,
|
|||||||
}
|
}
|
||||||
if (s->mb_x == s->resync_mb_x)
|
if (s->mb_x == s->resync_mb_x)
|
||||||
s->first_slice_line = 0;
|
s->first_slice_line = 0;
|
||||||
if(ret == SLICE_END) break;
|
if (ret == SLICE_END)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ff_er_add_slice(&s->er, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END);
|
ff_er_add_slice(&s->er, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y,
|
||||||
|
ER_MB_END);
|
||||||
|
|
||||||
return active_bits_size;
|
return active_bits_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
|
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
|
||||||
{
|
{
|
||||||
if(avctx->slice_count) return avctx->slice_offset[n];
|
if (avctx->slice_count)
|
||||||
else return AV_RL32(buf + n*8);
|
return avctx->slice_offset[n];
|
||||||
|
else
|
||||||
|
return AV_RL32(buf + n * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rv10_decode_frame(AVCodecContext *avctx,
|
static int rv10_decode_frame(AVCodecContext *avctx,
|
||||||
@ -644,8 +650,8 @@ static int rv10_decode_frame(AVCodecContext *avctx,
|
|||||||
const uint8_t *buf = avpkt->data;
|
const uint8_t *buf = avpkt->data;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
MpegEncContext *s = avctx->priv_data;
|
MpegEncContext *s = avctx->priv_data;
|
||||||
int i, ret;
|
|
||||||
AVFrame *pict = data;
|
AVFrame *pict = data;
|
||||||
|
int i, ret;
|
||||||
int slice_count;
|
int slice_count;
|
||||||
const uint8_t *slices_hdr = NULL;
|
const uint8_t *slices_hdr = NULL;
|
||||||
|
|
||||||
@ -713,7 +719,9 @@ static int rv10_decode_frame(AVCodecContext *avctx,
|
|||||||
if (s->last_picture_ptr || s->low_delay) {
|
if (s->last_picture_ptr || s->low_delay) {
|
||||||
*got_frame = 1;
|
*got_frame = 1;
|
||||||
}
|
}
|
||||||
s->current_picture_ptr= NULL; // so we can detect if frame_end was not called (find some nicer solution...)
|
|
||||||
|
// so we can detect if frame_end was not called (find some nicer solution...)
|
||||||
|
s->current_picture_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return avpkt->size;
|
return avpkt->size;
|
||||||
|
Reference in New Issue
Block a user