[Mplayer-cvslog] CVS: mpg12play mpg_header.c,NONE,1.1 Makefile,1.1.1.1,1.2 config.mak,1.1.1.1,1.2 mpegp.c,1.3,1.4

Gernot Ziegler madmac at users.sourceforge.net
Thu May 24 15:54:52 CEST 2001


Update of /cvsroot/mplayer/mpg12play
In directory usw-pr-cvs1:/tmp/cvs-serv8628

Modified Files:
	Makefile config.mak mpegp.c 
Added Files:
	mpg_header.c 
Log Message:
Compiling version

--- NEW FILE ---
// These are cloned functions from libmpeg2, I can't call them, and I don't know why !! 

/* default intra quant matrix, in zig-zag order */
static uint8_t default_intra_quantizer_matrix2[64] = {
    8,
    16, 16,
    19, 16, 19,
    22, 22, 22, 22,
    22, 22, 26, 24, 26,
    27, 27, 27, 26, 26, 26,
    26, 27, 27, 27, 29, 29, 29,
    34, 34, 34, 29, 29, 29, 27, 27,
    29, 29, 32, 32, 34, 34, 37,
    38, 37, 35, 35, 34, 35,
    38, 38, 40, 40, 40,
    48, 48, 46, 46,
    56, 56, 58,
    69, 69,
    83
};

uint8_t scan_norm2[64] =
{
    /* Zig-Zag scan pattern */
     0, 1, 8,16, 9, 2, 3,10,
    17,24,32,25,18,11, 4, 5,
    12,19,26,33,40,48,41,34,
    27,20,13, 6, 7,14,21,28,
    35,42,49,56,57,50,43,36,
    29,22,15,23,30,37,44,51,
    58,59,52,45,38,31,39,46,
    53,60,61,54,47,55,62,63
};

// A'rpis extension
static const int frameratecode2framerate[16] = {
   0, 24000*10000/1001, 24*10000,25*10000, 30000*10000/1001, 30*10000,50*10000,60000*10000/1001,
  60*10000, 0,0,0,0,0,0,0
};

// This definition is from mpeg2_internal.h
/* picture structure */
#define TOP_FIELD 1
#define BOTTOM_FIELD 2
#define FRAME_PICTURE 3


typedef struct motion_s {
    uint8_t * ref[2][3];
    int pmv[2][2];
    int f_code[2];
} motion_t;

typedef struct mypicture_s {
    /* first, state that carries information from one macroblock to the */
    /* next inside a slice, and is never used outside of slice_process() */

    /* DCT coefficients - should be kept aligned ! */
    int16_t DCTblock[64];
#ifdef IDCT2_INTERLEAVED
    int16_t DCTblock2[64];	/* Second DCTblock when x2 is used */
    uint8_t * dest;		/* Keep first DCTblock destination, if dest = 0 use block */
    int stride;			/* Keep first DCTblock destination stride */
#endif

    /* bit parsing stuff */
    uint32_t bitstream_buf;	/* current 32 bit working set of buffer */
    int bitstream_bits;		/* used bits in working set */
    uint8_t * bitstream_ptr;	/* buffer with stream data */

    /* Motion vectors */
    /* The f_ and b_ correspond to the forward and backward motion */
    /* predictors */
    motion_t b_motion;
    motion_t f_motion;

    /* predictor for DC coefficients in intra blocks */
    int16_t dc_dct_pred[3];

    int quantizer_scale;	/* remove */
    int current_field;		/* remove */


    /* now non-slice-specific information */

    /* sequence header stuff */
    uint8_t intra_quantizer_matrix [64];
    uint8_t non_intra_quantizer_matrix [64];

    /* The width and height of the picture snapped to macroblock units */
    int coded_picture_width;
    int coded_picture_height;

    /* picture header stuff */

    /* what type of picture this is (I, P, B, D) */
    int picture_coding_type;
	
    /* picture coding extension stuff */
	
    /* quantization factor for motion vectors */
    int f_code[2][2];
    /* quantization factor for intra dc coefficients */
    int intra_dc_precision;
    /* top/bottom/both fields */
    int picture_structure;
    /* bool to indicate all predictions are frame based */
    int frame_pred_frame_dct;
    /* bool to indicate whether intra blocks have motion vectors */
    /* (for concealment) */
    int concealment_motion_vectors;
    /* bit to indicate which quantization table to use */
    int q_scale_type;
    /* bool to use different vlc tables */
    int intra_vlc_format;
    /* used for DMV MC */
    int top_field_first;

    /* stuff derived from bitstream */

    /* pointer to the zigzag scan we're supposed to be using */
    uint8_t * scan;

    struct vo_frame_s * current_frame;
    struct vo_frame_s * forward_reference_frame;
    struct vo_frame_s * backward_reference_frame;

    int second_field;

    int mpeg1;

    /* these things are not needed by the decoder */
    /* this is a temporary interface, we will build a better one later. */
    int aspect_ratio_information;
    int frame_rate_code;
    int progressive_sequence;
    int repeat_first_field;
    int progressive_frame;
    int bitrate;

    // added by A'rpi/ESP-team:
    int repeat_count;
    int frame_rate;
} mypicture_t;

int header_process_sequence_extension2(struct mypicture_s * picture, uint8_t *buffer)
{
    /* check chroma format, size extensions, marker bit */
    if (((buffer[1] & 0x07) != 0x02) || (buffer[2] & 0xe0) ||
	((buffer[3] & 0x01) != 0x01))
	return 1;

    /* this is not used by the decoder */
    picture->progressive_sequence = (buffer[1] >> 3) & 1;

    if (picture->progressive_sequence)
	picture->coded_picture_height =
	    (picture->coded_picture_height + 31) & ~31;

    /* MPEG1 - for testing only */
    picture->mpeg1 = 0;

    return 0;
}


int header_process_sequence_header2 (struct mypicture_s * picture, uint8_t * buffer)
{
    int width, height;
    int i;

    printf("%s entered. (picture = %p)\n", __FUNCTION__, picture);

    for (i=0; i <= 10; i++)
      printf("0x%x ", buffer[i]);

    if ((buffer[6] & 0x20) != 0x20)
      {
	printf("Missing marker bit !\n");
	return 1;	/* missing marker_bit */
      }

    height = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2];

    width = ((height >> 12) + 15) & ~15;
    height = ((height & 0xfff) + 15) & ~15;
    printf("\nwidth=%d, height:%d\n", width, height);

    if ((width > 768) || (height > 576))
	return 1;	/* size restrictions for MP at ML or MPEG1 */

    picture->coded_picture_width = width;
    picture->coded_picture_height = height;

    /* this is not used by the decoder */
    picture->aspect_ratio_information = buffer[3] >> 4;
    picture->frame_rate_code = buffer[3] & 15;

    picture->frame_rate = frameratecode2framerate[picture->frame_rate_code];  //A'rpi extension

    picture->bitrate = (buffer[4]<<10)|(buffer[5]<<2)|(buffer[6]>>6);

    if (buffer[7] & 2) {
	for (i = 0; i < 64; i++)
	    picture->intra_quantizer_matrix[scan_norm2[i]] =
		(buffer[i+7] << 7) | (buffer[i+8] >> 1);
	buffer += 64;
    } else {
	for (i = 0; i < 64; i++)
	    picture->intra_quantizer_matrix[scan_norm2[i]] =
		default_intra_quantizer_matrix2 [i];
    }

    if (buffer[7] & 1) {
	for (i = 0; i < 64; i++)
	    picture->non_intra_quantizer_matrix[scan_norm2[i]] =
		buffer[i+8];
    } else {
	for (i = 0; i < 64; i++)
	    picture->non_intra_quantizer_matrix[i] = 16;
    }

    /* MPEG1 - for testing only */
    picture->mpeg1 = 1;
    picture->intra_dc_precision = 0;
    picture->frame_pred_frame_dct = 1;
    picture->q_scale_type = 0;
    picture->concealment_motion_vectors = 0;
    /* picture->alternate_scan = 0; */
    picture->picture_structure = FRAME_PICTURE;
    /* picture->second_field = 0; */

    printf("\n11written width=%d, height:%d\n", picture->coded_picture_width, picture->coded_picture_height);
    printf("\nwritten bitrate=%d, frame_rate:%d\n", picture->bitrate, picture->frame_rate);
    return 0;
}


Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/mpg12play/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Makefile	2001/05/15 01:20:50	1.1.1.1
--- Makefile	2001/05/24 13:54:24	1.2
***************
*** 7,13 ****
  SRCS = util/getch2.c util/timer-lx.c util/shmem.c
  OBJS = util/getch2.o util/timer-lx.o util/shmem.o
! CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo # -Wall
  A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3
! VO_LIBS = -Llibvo -lvo $(X_LIBS)
  
  .SUFFIXES: .c .o
--- 7,13 ----
  SRCS = util/getch2.c util/timer-lx.c util/shmem.c
  OBJS = util/getch2.o util/timer-lx.o util/shmem.o
! CFLAGS = $(OPTFLAGS) -Ilinux -Impeg2dec/include -I. # -Wall
  A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3
! VO_LIBS = mpeg2dec/src/cpu_accel.o -Lmpeg2dec/libvo/.libs -lvo $(X_LIBS)
  
  .SUFFIXES: .c .o
***************
*** 22,30 ****
  COMMONLIBS = libvo/libvo.a libac3/libac3.a mp3lib/libMP3.a
  
! libmpeg2/libmpeg2.a:
! 	cd libmpeg2; make; cd ..
  
! libvo/libvo.a:
! 	cd libvo; make; cd ..
  
  libac3/libac3.a:
--- 22,30 ----
  COMMONLIBS = libvo/libvo.a libac3/libac3.a mp3lib/libMP3.a
  
! mpeg2dec/libmpeg2/.libs/libmpeg2.a:
! 	make -C mpeg2dec
  
! mpeg2dec/libmpeg2/.libs/libvo.a:
! 	make -C libvo
  
  libac3/libac3.a:
***************
*** 34,39 ****
  	cd mp3lib; make; cd ..
  
! $(PRG_MPEG):	mpegp.o $(OBJS) libmpeg2/libmpeg2.a $(COMMONLIBS)
! 	$(CC) $(CFLAGS) -o $(PRG_MPEG) mpegp.o $(OBJS) $(A_LIBS) -lm $(TERMCAP_LIB) -Llibmpeg2 -lmpeg2 $(VO_LIBS)
  
  install: $(PRG_MPEG)
--- 34,39 ----
  	cd mp3lib; make; cd ..
  
! $(PRG_MPEG):	mpegp.o $(OBJS) mpeg2dec/libmpeg2/.libs/libmpeg2.a mpeg2dec/libmpeg2/.libs/libvo.a $(COMMONLIBS)
! 	$(CC) $(CFLAGS) -o $(PRG_MPEG) mpegp.o $(OBJS) $(A_LIBS) -lm $(TERMCAP_LIB) -Lmpeg2dec/libmpeg2/.libs -lmpeg2 $(VO_LIBS)
  
  install: $(PRG_MPEG)

Index: config.mak
===================================================================
RCS file: /cvsroot/mplayer/mpg12play/config.mak,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** config.mak	2001/05/15 01:20:50	1.1.1.1
--- config.mak	2001/05/24 13:54:50	1.2
***************
*** 6,10 ****
  OPTFLAGS=-O4 -march=i686 -mcpu=i686 -pipe -fomit-frame-pointer -ffast-math
  # LIBS=-L/usr/lib -L/usr/local/lib -L/usr/X11R6/lib -lGL  -lX11 -lXext 
! X_LIBS=-L/usr/X11R6/lib -lGL  -lX11 -lXext 
  TERMCAP_LIB=-ltermcap
  
--- 6,10 ----
  OPTFLAGS=-O4 -march=i686 -mcpu=i686 -pipe -fomit-frame-pointer -ffast-math
  # LIBS=-L/usr/lib -L/usr/local/lib -L/usr/X11R6/lib -lGL  -lX11 -lXext 
! X_LIBS=-L/usr/X11R6/lib -lGL  -lX11 -lXext -lXv -lSDL 
  TERMCAP_LIB=-ltermcap
  

Index: mpegp.c
===================================================================
RCS file: /cvsroot/mplayer/mpg12play/mpegp.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** mpegp.c	2001/05/24 13:33:57	1.3
--- mpegp.c	2001/05/24 13:54:50	1.4
***************
*** 40,47 ****
  #endif
  
! #include "linux/getch2.h"
! #include "linux/keycodes.h"
! #include "linux/timer.h"
! #include "linux/shmem.h"
  
  #include "help_mpg.h"
--- 40,47 ----
  #endif
  
! #include "util/getch2.h"
! #include "util/keycodes.h"
! #include "util/timer.h"
! #include "util/shmem.h"
  
  #include "help_mpg.h"


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list