[Ffmpeg-devel] Re: [Ffmpeg-devel-old] H.264 multislice implementation

Måns Rullgård mru
Tue Apr 12 14:12:17 CEST 2005


Champ Yan <champ_yen at yahoo.com.tw> writes:

> Dear all:
>     It seems that the H.264 decoder in FFMPEG doesn't
> support more than one slice in a frame. I have traced
> the source. In decode_nal_units(), it decodes one
> slice per frame. However, in JM reference software, it
> detects frame boundary by checking header values. It
> means prefetch the header of next slice is needed.
> However, it may not be a pratical implementation. Does
> anyone has a good idea.? Or only make use of access
> unit delimiter...

The only way to reliably determine frame boundaries, is by looking
ahead to the start of the next NAL unit.  Quoting the spec:

  7.4.1.2.4 Detection of the first VCL NAL unit of a primary coded picture

  Any coded slice NAL unit or coded slice data partition A NAL unit of
  the primary coded picture of the current access unit shall be
  different from any coded slice NAL unit or coded slice data
  partition A NAL unit of the primary coded picture of the previous
  access unit in one or more of the following ways.

  - frame_num differs in value.
  - field_pic_flag differs in value.
  - bottom_field_flag is present in both and differs in value.
  - nal_ref_idc differs in value with one of the nal_ref_idc values
    being equal to 0.
  - frame_num is the same for both and pic_order_cnt_type is equal to
    0 for both and either pic_order_cnt_lsb differs in value, or
    delta_pic_order_cnt_bottom differs in value.
  - frame_num is the same for both and pic_order_cnt_type is equal to
    1 for both and either delta_pic_order_cnt[ 0 ] differs in value, or
    delta_pic_order_cnt[ 1 ] differs in value.
  - nal_unit_type is equal to 5 for both and idr_pic_id differs in
    value.

  NOTE ? Some of the VCL NAL units in redundant coded pictures or some
  non-VCL NAL units (e.g. an access unit delimiter NAL unit) may also
  be used for the detection of the boundary between access units, and
  may therefore aid in the detection of the start of a new primary
  coded picture.

-- 
M?ns Rullg?rd
mru at inprovide.com





More information about the ffmpeg-devel mailing list