[FFmpeg-devel] Copy user data in H264 for captions
Michael Niedermayer
michaelni at gmx.at
Wed Oct 30 21:49:41 CET 2013
On Wed, Oct 30, 2013 at 09:43:57PM +0100, Michael Niedermayer wrote:
> On Wed, Oct 30, 2013 at 06:20:14PM +0530, Radha Krishna Ramachandruni wrote:
> > Patch for copying ITU_T registered user data to AVFrame for extracting
> > closed captions.
> >
> >
> > rkrishna
>
> > libavcodec/h264.c | 17 ++-
> > libavcodec/h264.h | 9 +
> > libavcodec/h264_sei.c | 228 ++++++++++++++++++++++++++++++++++++++++++++------
> > libavutil/common.h | 5 +
> > 4 files changed, 228 insertions(+), 31 deletions(-)
> > 6669e36e8a72f265bc701f5263151652aa42c22f ffmpeg-h264cc.patch
> > diff --git a/mythtv/external/FFmpeg/libavcodec/h264.c b/mythtv/external/FFmpeg/libavcodec/h264.c
> > index 3a83b4b..e8c0735 100644
> > --- a/mythtv/external/FFmpeg/libavcodec/h264.c
> > +++ b/mythtv/external/FFmpeg/libavcodec/h264.c
> > @@ -1742,10 +1742,19 @@
> >
> > pic->f.reference = h->droppable ? 0 : h->picture_structure;
> > pic->f.coded_picture_number = h->coded_picture_number++;
> > pic->field_picture = h->picture_structure != PICT_FRAME;
> >
> > +
> > + /* Put ATSC captions cached from parse_user_data into the correct frame */
> > + memcpy(pic->f.atsc_cc_buf, h->tmp_atsc_cc_buf, h->tmp_atsc_cc_len);
> > + pic->f.atsc_cc_len = h->tmp_atsc_cc_len;
> > + h->tmp_atsc_cc_len = 0;
> > + memcpy(pic->f.scte_cc_buf, h->tmp_scte_cc_buf, h->tmp_scte_cc_len);
> > + pic->f.scte_cc_len = h->tmp_scte_cc_len;
> > + h->tmp_scte_cc_len = 0;
>
> there are no such fields on AVFrame
>
>
> > +
> > /*
> > * Zero key_frame here; IDR markings per slice in frame or fields are ORed
> > * in later.
> > * See decode_nal_units().
> > */
>
> > @@ -2775,12 +2784,11 @@
> > * and a bad error table. Further, the error count goes to
> > * INT_MAX when called for bottom field, because mb_y is
> > * past end by one (callers fault) and resync_mb_y != 0
> > * causes problems for the first MB line, too.
> > */
> > - if (CONFIG_ERROR_RESILIENCE &&
> > - !FIELD_PICTURE && h->current_slice && !h->sps.new) {
> > + if (CONFIG_ERROR_RESILIENCE && !FIELD_PICTURE && h->current_slice && !h->sps.new && h->avctx->skip_frame < AVDISCARD_ALL) {
> > h->er.cur_pic = h->cur_pic_ptr;
> > ff_er_frame_end(&h->er);
> > }
> > emms_c();
> >
>
> looks unrelated
>
>
> > @@ -4519,12 +4527,13 @@
> > case NAL_SLICE:
> > first_slice = hx->nal_unit_type;
> > }
> >
> > // FIXME do not discard SEI id
> > - if (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0)
> > - continue;
> > + if (avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0
> > + && hx->nal_unit_type != NAL_SLICE && hx->nal_unit_type != NAL_SEI)
> > + continue;
> >
>
> looks unrelated
> also contains tabs, which arent allowed in c files in ffmpeg git
>
> also the patch doesnt apply
>
> patching file libavcodec/h264.c
> Hunk #1 succeeded at 1951 with fuzz 2 (offset 209 lines).
> Hunk #2 FAILED at 2784.
> Hunk #3 FAILED at 4528.
> 2 out of 3 hunks FAILED -- saving rejects to file libavcodec/h264.c.rej
> patching file libavcodec/h264.h
> Hunk #1 succeeded at 668 (offset 30 lines).
> patching file libavcodec/h264_sei.c
> Hunk #1 FAILED at 92.
> Hunk #2 FAILED at 221.
> 2 out of 2 hunks FAILED -- saving rejects to file libavcodec/h264_sei.c.rej
> patching file libavutil/common.h
also, what i forgot, its very important code is tested too
(cosidering that it doesnt apply and doesnt look complete, i suspect
it wasnt tested with ffmpeg HEAD, and thats very bad)
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131030/07327f21/attachment.asc>
More information about the ffmpeg-devel
mailing list