changeset 1432:7406ed4479f7 libavcodec

fixing unused f_code values 10l (forgot to update the regression test scores after the closed gop bit fix)
author michaelni
date Sat, 30 Aug 2003 19:40:30 +0000
parents e2f288bcfaa4
children 46d3fa8501cd
files mpeg12.c
diffstat 1 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mpeg12.c	Sat Aug 30 19:31:49 2003 +0000
+++ b/mpeg12.c	Sat Aug 30 19:40:30 2003 +0000
@@ -392,13 +392,19 @@
     // RAL: Forward f_code also needed for B frames
     if (s->pict_type == P_TYPE || s->pict_type == B_TYPE) {
         put_bits(&s->pb, 1, 0); /* half pel coordinates */
-        put_bits(&s->pb, 3, s->f_code); /* forward_f_code */
+        if(s->codec_id == CODEC_ID_MPEG1VIDEO)
+            put_bits(&s->pb, 3, s->f_code); /* forward_f_code */
+        else
+            put_bits(&s->pb, 3, 7); /* forward_f_code */
     }
     
     // RAL: Backward f_code necessary for B frames
     if (s->pict_type == B_TYPE) {
         put_bits(&s->pb, 1, 0); /* half pel coordinates */
-        put_bits(&s->pb, 3, s->b_code); /* backward_f_code */
+        if(s->codec_id == CODEC_ID_MPEG1VIDEO)
+            put_bits(&s->pb, 3, s->b_code); /* backward_f_code */
+        else
+            put_bits(&s->pb, 3, 7); /* backward_f_code */
     }
 
     put_bits(&s->pb, 1, 0); /* extra bit picture */
@@ -406,10 +412,18 @@
     if(s->codec_id == CODEC_ID_MPEG2VIDEO){
         put_header(s, EXT_START_CODE);
         put_bits(&s->pb, 4, 8); //pic ext
-        put_bits(&s->pb, 4, s->f_code);
-        put_bits(&s->pb, 4, s->f_code);
-        put_bits(&s->pb, 4, s->b_code);
-        put_bits(&s->pb, 4, s->b_code);
+        if (s->pict_type == P_TYPE || s->pict_type == B_TYPE) {
+            put_bits(&s->pb, 4, s->f_code);
+            put_bits(&s->pb, 4, s->f_code);
+        }else{
+            put_bits(&s->pb, 8, 255);
+        }
+        if (s->pict_type == B_TYPE) {
+            put_bits(&s->pb, 4, s->b_code);
+            put_bits(&s->pb, 4, s->b_code);
+        }else{
+            put_bits(&s->pb, 8, 255);
+        }
         put_bits(&s->pb, 2, s->intra_dc_precision);
         put_bits(&s->pb, 2, s->picture_structure= PICT_FRAME);
         put_bits(&s->pb, 1, s->top_field_first);