summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorIvan Kalvachev <ikalvachev@gmail.com>2004-03-16 15:38:40 +0000
committerIvan Kalvachev <ikalvachev@gmail.com>2004-03-16 15:38:40 +0000
commit6fe1a1a55b90849974a22118040aef6e17999688 (patch)
treec4c0a70651c9cbb71fdd6ab665d8373420d9579c /libavcodec/mpeg12.c
parent5ac4768362c7a7ea336e3c0d203a9f5bd451a9bb (diff)
use pan_scan to remove some weight, proper pan_scan offset reading
Originally committed as revision 2898 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index c1b7181579..9cfc36d41d 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1750,8 +1750,6 @@ typedef struct Mpeg1Context {
MpegEncContext mpeg_enc_ctx;
int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
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 */
int slice_count;
int swap_uv;//indicate VCR2
@@ -1838,7 +1836,7 @@ uint8_t old_permutation[64];
1<<30);
//mpeg2 aspect
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=
av_div_q(
mpeg2_aspect[s->aspect_ratio_info],
@@ -1848,7 +1846,7 @@ uint8_t old_permutation[64];
s->avctx->sample_aspect_ratio=
av_div_q(
mpeg2_aspect[s->aspect_ratio_info],
- (AVRational){s1->display_weight, s1->display_height}
+ (AVRational){s1->pan_scan.width, s1->pan_scan.height}
);
}
}else{
@@ -2018,11 +2016,7 @@ static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
s1->pan_scan.width= 16*w;
s1->pan_scan.height=16*h;
-
- s1->display_weight = w;
- s1->display_height = h;
-
-
+
if(s->avctx->debug & FF_DEBUG_PICT_INFO)
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)
static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
{
MpegEncContext *s= &s1->mpeg_enc_ctx;
- int i;
-
- for(i=0; i<1; i++){ //FIXME count
+ int i,nofco;
+
+ 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);
skip_bits(&s->gb, 1); //marker
s1->pan_scan.position[i][1]= get_sbits(&s->gb, 16);