avcodec/mpegvideo: Move startcodes to mpeg12.h

And remove the MPEG-4-specific SLICE_START_CODE, which duplicates
SLICE_STARTCODE.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-09-12 19:02:18 +02:00
parent 044a7c08dc
commit 9c489a0f3a
4 changed files with 13 additions and 15 deletions

View File

@ -217,11 +217,11 @@ int ff_h263_resync(MpegEncContext *s){
if(s->codec_id==AV_CODEC_ID_MPEG4 && s->studio_profile) {
align_get_bits(&s->gb);
while (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) != SLICE_START_CODE) {
while (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) != SLICE_STARTCODE) {
get_bits(&s->gb, 8);
}
if (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) == SLICE_START_CODE)
if (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) == SLICE_STARTCODE)
return get_bits_count(&s->gb);
else
return -1;

View File

@ -25,6 +25,16 @@
#include "mpeg12vlc.h"
#include "mpegvideo.h"
/* Start codes. */
#define SEQ_END_CODE 0x000001b7
#define SEQ_START_CODE 0x000001b3
#define GOP_START_CODE 0x000001b8
#define PICTURE_START_CODE 0x00000100
#define SLICE_MIN_START_CODE 0x00000101
#define SLICE_MAX_START_CODE 0x000001af
#define EXT_START_CODE 0x000001b5
#define USER_START_CODE 0x000001b2
void ff_mpeg12_common_init(MpegEncContext *s);
#define INIT_2D_VLC_RL(rl, static_size, flags)\

View File

@ -550,7 +550,7 @@ int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext *ctx)
unsigned vlc_len;
uint16_t mb_num;
if (get_bits_left(gb) >= 32 && get_bits_long(gb, 32) == SLICE_START_CODE) {
if (get_bits_left(gb) >= 32 && get_bits_long(gb, 32) == SLICE_STARTCODE) {
vlc_len = av_log2(s->mb_width * s->mb_height) + 1;
mb_num = get_bits(gb, vlc_len);

View File

@ -63,18 +63,6 @@
#define MAX_B_FRAMES 16
/* Start codes. */
#define SEQ_END_CODE 0x000001b7
#define SEQ_START_CODE 0x000001b3
#define GOP_START_CODE 0x000001b8
#define PICTURE_START_CODE 0x00000100
#define SLICE_MIN_START_CODE 0x00000101
#define SLICE_MAX_START_CODE 0x000001af
#define EXT_START_CODE 0x000001b5
#define USER_START_CODE 0x000001b2
#define SLICE_START_CODE 0x000001b7
/**
* MpegEncContext.
*/