Commit 6fe1a1a5 authored by Ivan Kalvachev's avatar Ivan Kalvachev

use pan_scan to remove some weight, proper pan_scan offset reading

Originally committed as revision 2898 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 5ac47683
...@@ -1750,8 +1750,6 @@ typedef struct Mpeg1Context { ...@@ -1750,8 +1750,6 @@ typedef struct Mpeg1Context {
MpegEncContext mpeg_enc_ctx; MpegEncContext mpeg_enc_ctx;
int mpeg_enc_ctx_allocated; /* true if decoding context allocated */ int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
int repeat_field; /* true if we must repeat the field */ int repeat_field; /* true if we must repeat the field */
int display_weight;
int display_height;
AVPanScan pan_scan; /** some temporary storage for the panscan */ AVPanScan pan_scan; /** some temporary storage for the panscan */
int slice_count; int slice_count;
int swap_uv;//indicate VCR2 int swap_uv;//indicate VCR2
...@@ -1838,7 +1836,7 @@ uint8_t old_permutation[64]; ...@@ -1838,7 +1836,7 @@ uint8_t old_permutation[64];
1<<30); 1<<30);
//mpeg2 aspect //mpeg2 aspect
if(s->aspect_ratio_info > 1){ if(s->aspect_ratio_info > 1){
if( (s1->display_weight == 0 )||(s1->display_height == 0) ){ if( (s1->pan_scan.width == 0 )||(s1->pan_scan.height == 0) ){
s->avctx->sample_aspect_ratio= s->avctx->sample_aspect_ratio=
av_div_q( av_div_q(
mpeg2_aspect[s->aspect_ratio_info], mpeg2_aspect[s->aspect_ratio_info],
...@@ -1848,7 +1846,7 @@ uint8_t old_permutation[64]; ...@@ -1848,7 +1846,7 @@ uint8_t old_permutation[64];
s->avctx->sample_aspect_ratio= s->avctx->sample_aspect_ratio=
av_div_q( av_div_q(
mpeg2_aspect[s->aspect_ratio_info], mpeg2_aspect[s->aspect_ratio_info],
(AVRational){s1->display_weight, s1->display_height} (AVRational){s1->pan_scan.width, s1->pan_scan.height}
); );
} }
}else{ }else{
...@@ -2019,10 +2017,6 @@ static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1) ...@@ -2019,10 +2017,6 @@ static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
s1->pan_scan.width= 16*w; s1->pan_scan.width= 16*w;
s1->pan_scan.height=16*h; s1->pan_scan.height=16*h;
s1->display_weight = w;
s1->display_height = h;
if(s->avctx->debug & FF_DEBUG_PICT_INFO) if(s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_DEBUG, "sde w:%d, h:%d\n", w, h); av_log(s->avctx, AV_LOG_DEBUG, "sde w:%d, h:%d\n", w, h);
} }
...@@ -2030,9 +2024,23 @@ static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1) ...@@ -2030,9 +2024,23 @@ static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
static void mpeg_decode_picture_display_extension(Mpeg1Context *s1) static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
{ {
MpegEncContext *s= &s1->mpeg_enc_ctx; MpegEncContext *s= &s1->mpeg_enc_ctx;
int i; int i,nofco;
for(i=0; i<1; i++){ //FIXME count nofco = 1;
if(s->progressive_sequence){
if(s->repeat_first_field){
nofco++;
if(s->top_field_first)
nofco++;
}
}else{
if(s->picture_structure == PICT_FRAME){
nofco++;
if(s->repeat_first_field)
nofco++;
}
}
for(i=0; i<nofco; i++){
s1->pan_scan.position[i][0]= get_sbits(&s->gb, 16); s1->pan_scan.position[i][0]= get_sbits(&s->gb, 16);
skip_bits(&s->gb, 1); //marker skip_bits(&s->gb, 1); //marker
s1->pan_scan.position[i][1]= get_sbits(&s->gb, 16); s1->pan_scan.position[i][1]= get_sbits(&s->gb, 16);
......
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