|
From: | Simon Morlat |
Subject: | Re: [Linphone-developers] H.263 bitstream syntax error ; an FFMPEG problem? |
Date: | Wed, 1 Mar 2006 11:51:39 +0100 |
User-agent: | KMail/1.9.1 |
Hello, I had a look at ffmpeg code and here's what I saw. When UFEP=1, ffmpeg considers that there is an optional PLUS PTYPE bitfield. Here is an extract of the h263_decode_pict_header(): /* H.263v2 */ s->h263_plus = 1; ufep = get_bits(&s->gb, 3); /* Update Full Extended PTYPE */ /* ufep other than 0 and 1 are reserved */ if (ufep == 1) { /* OPPTYPE */ format = get_bits(&s->gb, 3); dprintf("ufep=1, format: %d\n", format); s->custom_pcf= get_bits1(&s->gb); s->umvplus = get_bits(&s->gb, 1); /* Unrestricted Motion Vector */ if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n"); } s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */ s->h263_aic = get_bits1(&s->gb); /* Advanced Intra Coding (AIC) */ s->loop_filter= get_bits1(&s->gb); s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter; s->h263_slice_structured= get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n"); } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n"); } s->alt_inter_vlc= get_bits1(&s->gb); s->modified_quant= get_bits1(&s->gb); if(s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; skip_bits(&s->gb, 1); /* Prevent start code emulation */ skip_bits(&s->gb, 3); /* Reserved */ } else if (ufep != 0) { av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep); return -1; } /* MPPTYPE */ s->pict_type = get_bits(&s->gb, 3); switch(s->pict_type){ case 0: s->pict_type= I_TYPE;break; case 1: s->pict_type= P_TYPE;break; case 3: s->pict_type= B_TYPE;break; case 7: s->pict_type= I_TYPE;break; //ZYGO default: return -1; } skip_bits(&s->gb, 2); s->no_rounding = get_bits1(&s->gb); skip_bits(&s->gb, 4); ... Maybe UFEP=1 is not in H283+ baseline ? The H263 encoding function behaves like this : int ufep=1; /* H.263v2 */ /* H.263 Plus PTYPE */ put_bits(&s->pb, 3, 7); put_bits(&s->pb,3,ufep); /* Update Full Extended PTYPE */ if (format == 7) put_bits(&s->pb,3,6); /* Custom Source Format */ else put_bits(&s->pb, 3, format); put_bits(&s->pb,1, s->custom_pcf); put_bits(&s->pb,1, s->umvplus); /* Unrestricted Motion Vector */ put_bits(&s->pb,1,0); /* SAC: off */ put_bits(&s->pb,1,s->obmc); /* Advanced Prediction Mode */ put_bits(&s->pb,1,s->h263_aic); /* Advanced Intra Coding */ put_bits(&s->pb,1,s->loop_filter); /* Deblocking Filter */ put_bits(&s->pb,1,s->h263_slice_structured); /* Slice Structured */ put_bits(&s->pb,1,0); /* Reference Picture Selection: off */ put_bits(&s->pb,1,0); /* Independent Segment Decoding: off */ put_bits(&s->pb,1,s->alt_inter_vlc); /* Alternative Inter VLC */ put_bits(&s->pb,1,s->modified_quant); /* Modified Quantization: */ put_bits(&s->pb,1,1); /* "1" to prevent start code emulation */ put_bits(&s->pb,3,0); /* Reserved */ put_bits(&s->pb, 3, s->pict_type == P_TYPE); put_bits(&s->pb,1,0); /* Reference Picture Resampling: off */ put_bits(&s->pb,1,0); /* Reduced-Resolution Update: off */ put_bits(&s->pb,1,s->no_rounding); /* Rounding Type */ put_bits(&s->pb,2,0); /* Reserved */ put_bits(&s->pb,1,1); /* "1" to prevent start code emulation */ One thing is sure: what you sees as PPTYPE is not a PPTYPE but an "OPPTYPE", the PPTYPE is 18 bits "later". Simon Le Vendredi 24 Février 2006 15:29, Francois-Xavier KOWALSKI a écrit : > Folks, > > FYI, the H.263 video bitstream generated by FFMPEG is an H.263-1998 with > a syntax error in the picture header. This error is located in the > mandatory PTYPE bitfield. It may cause H.263 decoder to abort the stream. > > ----------H.263+ : MANDATORY PLUS PTYPE---------- > pict_type: 000(0) > reference_picture_resampling_mode: 0(0) > reduced_resolution_update_mode: 0(0) > rounding_type: 0(0) > rtype: 0(0) > reserve, reserve, spare: *101*(5) <= should be 001(1) > > The H.263 specs (I checked from H.263v1 to H.263v3) states the following: > > 5.1.4.3 The mandatory part of PLUSPTYPE when PLUSPTYPE present > (MPPTYPE) (9 bits) > Regardless of the value of UFEP, the following 9 bits are also > present in PLUSPTYPE: > – Bits 1-3 Picture Type Code: > "000" I-picture (INTRA), > "001" P-picture (INTER), > "010" Improved PB-frame (see Annex M), > "011" B-picture (see Annex O), > "100" EI-picture (see Annex O), > "101" EP-picture (see Annex O), > "110" Reserved, > "111" Reserved; > – Bit 4 Optional Reference Picture Resampling (RPR) mode (see Annex > P), "0" off, > "1" on; > – Bit 5 Optional Reduced-Resolution Update (RRU) mode (see Annex Q), > "0" off, "1" > on; > – Bit 6 Rounding Type (RTYPE) (see 6.1.2); > *– Bit 7 Reserved, shall be equal to "0"; > – Bit 8 Reserved, shall be equal to "0"; > – Bit 9 Equal to "1" to prevent start code emulation.* |
[Prev in Thread] | Current Thread | [Next in Thread] |