| Branch: | Revision:

ffmpeg / libavcodec / h264.c @ 154f7bb0

History | View | Annotate | Download (128 KB)

# Date Author Comment
154f7bb0 02/09/2011 02:33 AM Janne Grunau

h264: define FF_PROFILE_H264_HIGH_444 to the correct value

It was removed in fe9a3fb since it had the wrong value. Add profile name
for it.
(cherry picked from commit 440b61691db2166abac3f58e01da1d4722f1f1e4)

45eaec30 02/02/2011 02:40 AM Anssi Hannula

h264: add profile names for the existing defines

Signed-off-by: Janne Grunau <>
(cherry picked from commit 71e0bee9eabe8eea030e210f1ad74c380b8b250b)

94e3e83f 02/02/2011 02:40 AM Janne Grunau

h264: Add Intra and Constrained Baseline profiles to avctx.profile
(cherry picked from commit fe9a3fbe42ebe5debd57550313ed4c3a065f1770)

d23e3e5f 01/30/2011 02:41 AM Ronald S. Bultje

Move ff_emulated_edge_mc() into DSPContext.
(cherry picked from commit 2e279598793133ee9c57fd0026d672f076fde4bf)

e7e2df27 01/28/2011 02:15 AM Diego Elio Pettenò

Add ff_ prefix to data symbols of encoders, decoders, hwaccel, parsers, bsf.

None of these symbols should be accessed directly, so declare them as

Signed-off-by: Mans Rullgard <>
(cherry picked from commit d36beb3f6902b1217beda576aa18abf7eb72b03c)

877937b3 01/26/2011 02:43 AM Diego Elio Pettenò

Make ff_h264_find_frame_end static to h264.c; delete h264_parser.h

The header is empty after making the function static, so delete it and
drop its usage.

Signed-off-by: Janne Grunau <>
(cherry picked from commit 13eb6b90977768116c937c5d6b2e074679a3ad21)

12324121 01/26/2011 02:43 AM Diego Elio Pettenò

Make ff_h264_decode_rbsp_trailing static to h264.c

Signed-off-by: Janne Grunau <>
(cherry picked from commit 8529731961d79fc0e747b16152df3d470b530537)

fb397b1a 01/23/2011 06:32 PM Ronald S. Bultje


Signed-off-by: Janne Grunau <>
(cherry picked from commit fcb7e535dd9ad142c079af62af9c1d0f4b001057)

2ed0f766 01/23/2011 06:32 PM Ronald S. Bultje

Fix crash on resolution change (issue 2393).

Don't free RBSP tables (containing decoded NAL units) on resolution
change, because we actually need this data to decode the frame after
reiniting (with new resolution). Fixed issue 2393.

Signed-off-by: Janne Grunau <>...

d5ec00ba 01/23/2011 06:32 PM Alex Converse

Remove H.264 encoder fragments

It's incomplete, no one is working on it, and when someone asks about
working on it we advise them not to.

Signed-off-by: Mans Rullgard <>
(cherry picked from commit ff3d43104fa5df0a3f4b52ff9b989ce2d11ad35d)

772225c0 01/21/2011 07:36 PM Ronald S. Bultje

Revert 2a1f431d38ea9c05abb215d70c7dc09cdb6888ab, it broke H264 lossless.
(cherry picked from commit 66c6b5e2a5e6376c4a5c65b1d96fd7a1580bdfcf)

2a1f431d 01/15/2011 01:10 AM Jason Garrett-Glaser

H.264/SVQ3: make chroma DC work the same way as luma DC
No speed improvement, but necessary for some future stuff.
Also opens up the possibility of asm chroma dc idct/dequant.

Originally committed as revision 26349 to svn://

290fabc6 01/15/2011 12:41 AM Jason Garrett-Glaser

Port SVQ3 to use the new mb_luma_dc method of storing luma DC coefficients.
Doesn't help speed as there isn't an asm implementation yet, but consistency
is a good thing.

Originally committed as revision 26348 to svn://

65344775 01/14/2011 11:46 PM Jason Garrett-Glaser

H.264: Remove useless arg to chroma_dc_dequant_idct_c

Originally committed as revision 26345 to svn://

2e186601 01/14/2011 10:23 PM Jason Garrett-Glaser

Fix SVQ3
Regression in r26336-7.

Originally committed as revision 26341 to svn://

0d1d01cf 01/14/2011 09:36 PM Jason Garrett-Glaser

Reindent after r26337.

Originally committed as revision 26338 to svn://

5657d140 01/14/2011 09:36 PM Jason Garrett-Glaser

H.264: switch to x264-style tracking of luma/chroma DC NNZ
Useful so that we don't have to run the hierarchical DC iDCT if there aren't
any coefficients. Opens up some future opportunities for optimization as well.

Originally committed as revision 26337 to svn://

19fb234e 01/14/2011 09:34 PM Jason Garrett-Glaser

H.264: split luma dc idct out and implement MMX/SSE2 versions
About 2.5x the speed.

NOTE: the way that the asm code handles large qmuls is a bit suboptimal.
If x264-style dequant was used (separate shift and qmul values), it might
be possible to get some extra speed....

ca32f7f2 01/14/2011 07:04 PM Jason Garrett-Glaser

H.264: eliminate non-transposed scantable support.
It was an ugly hack to begin with and didn't give any performance.

NOTE: this patch opens up some future simplifications to be made (such as
removing some of the scantables from H264Context) but doesn't take advantage...

09fffe9b 01/10/2011 11:42 PM Jason Garrett-Glaser

H.264: fix grayscale decoding with explicit wpred

Originally committed as revision 26306 to svn://

0f016023 12/15/2010 12:22 AM Alexander Strange

SVQ3: Allow decoding if thread_count is > 1

svq3 still doesn't support multithreading, but it's simpler for clients if
they can enable threading for all codecs by default.

Originally committed as revision 26015 to svn://

9d252137 11/23/2010 01:16 AM Baptiste Coudurier

In h264 decoder, fix decoding when nal end sequence is present

Originally committed as revision 25809 to svn://

00d1e96b 11/03/2010 08:52 PM Reimar Döffinger

H.264 decode: support cropping up to 28 pixels in interlaced mode.
Contrary to progressive, just being able to crop up to 14/15 pixels
is not enough to encode all supported resolutions, and the new
behaviour is also consistent with e.g. MPEG-2 etc.

Originally committed as revision 25669 to svn://

5dd7f994 10/05/2010 05:24 PM Carl Eugen Hoyos

Do not assume PIX_FMT_YUV420P will remain the only supported output format for H264.

Originally committed as revision 25352 to svn://

cfa5a81e 10/05/2010 01:43 AM Michael Niedermayer

Move aspect ratio 0/0 avoidance code so the values in the sps struct are not missed.
This preempts issues with av_cmp_q(0/0, X)

Originally committed as revision 25337 to svn://

4dece8c7 09/28/2010 09:06 AM Jason Garrett-Glaser

Try to fix crashes introduced by r25218

r25218 made assumptions about the existence of past reference frames that
weren't necessarily true.

Originally committed as revision 25243 to svn://

e2983d6e 09/27/2010 04:43 AM Jason Garrett-Glaser

Improve error concealment of lost frames
If a frame is lost, replace it with data from the previous valid frame.

Originally committed as revision 25218 to svn://

1d16a1cf 09/14/2010 01:36 PM Ronald S. Bultje

Rename h264_idct_sse2.asm to h264_idct.asm; move inline IDCT asm from
h264dsp_mmx.c to h264_idct.asm (as yasm code). Because the loops are now
coded in asm instead of C, this is (depending on the function) up to 50%
faster for cases where gcc didn't do a great job at looping....

3d542120 07/05/2010 02:36 PM Michael Niedermayer

Perform sliding window operation during frame gap handling.
This avoids some warnings about too many reference frames.

Originally committed as revision 24057 to svn://

bb943bb8 07/03/2010 04:40 AM Baptiste Coudurier

Give context to av_log

Originally committed as revision 24018 to svn://

6da88bd3 07/02/2010 11:54 AM Diego Biurrun

Fix typo in Doxygen function parameter name.

Originally committed as revision 23983 to svn://

49bd8e4b 06/30/2010 03:38 PM Måns Rullgård

Fix grammar errors in documentation

Originally committed as revision 23904 to svn://

9ad7dfc1 05/31/2010 10:01 PM Baptiste Coudurier

Pass codec pixel format list to get_format, if present, fix vdpau decoding

Originally committed as revision 23396 to svn://

0435fb16 05/28/2010 11:15 PM Baptiste Coudurier

In h264 decoder, use jpeg yuv pixel format when full range is set in vui

Originally committed as revision 23369 to svn://

05e95319 05/26/2010 07:00 PM Howard Chu

Factorize ff_h264_decode_extradata().

Patch by Howard Chu, hyc highlandsun com

Originally committed as revision 23340 to svn://

ba87f080 04/20/2010 02:45 PM Diego Biurrun

Remove explicit filename from Doxygen @file commands.

Passing an explicit filename to this command is only necessary if the
documentation in the @file block refers to a file different from the
one the block resides in.

Originally committed as revision 22921 to svn://

6752a3cc 04/15/2010 01:16 PM Gwenole Beauchesne

H.264: cosmetics (vertical align).

Originally committed as revision 22885 to svn://

fa37cf0d 04/15/2010 08:30 AM Gwenole Beauchesne

H.264: move avctx->{profile,level} init before AVCodecContext.get_format().

Originally committed as revision 22884 to svn://

b08e38e8 04/15/2010 08:27 AM Gwenole Beauchesne

H.264: move avctx->refs init before AVCodecContext.get_format().

Originally committed as revision 22883 to svn://

d02bb3ec 04/13/2010 10:15 PM Diego Biurrun

Move static function fill_filter_caches() from h264.h to h264.c.
The function is only used within that file, so it makes sense to place
it there. This fixes many warnings of the type:
h264.h:1170: warning: ‘fill_filter_caches’ defined but not used

Originally committed as revision 22876 to svn://

7a5c850b 03/31/2010 03:55 AM Alexander Strange

H264: Copy h264dsp when creating new slice threads

Fixes slice multithreading (broken in r22565)
Fixes issue1815

Originally committed as revision 22740 to svn://

72415b2a 03/30/2010 11:30 PM Stefano Sabatini

Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.

Originally committed as revision 22735 to svn://

1052b76f 03/30/2010 09:05 PM Michael Niedermayer

Fix implicit weight for b frames in mbaff.

Originally committed as revision 22733 to svn://

3bccd93a 03/30/2010 08:10 AM Stephen Warren

Set VDPAU H264 picture parameter field_order_cnt and frame_num at the
start of decoding a picture instead of at the end.
Fixes mmco01.264

Patch by Stephen Warren

Originally committed as revision 22728 to svn://

6f2c72c1 03/23/2010 05:55 PM Diego Biurrun

Remove unused variable, fixes the warning:
libavcodec/h264.c:1562: warning: unused variable `s'

Originally committed as revision 22647 to svn://

5388f0b4 03/18/2010 11:36 PM Janusz Krzysztofik

Reinitialize the h264 decoder context on every valid aspect ratio
change, not only size changes.

Patch by Janusz Krzysztofik foo=zyszt <>.

Originally committed as revision 22597 to svn://

4693b031 03/16/2010 01:17 AM Måns Rullgård

Move H264 dsputil functions into their own struct

This moves the H264-specific functions from DSPContext to the new
H264DSPContext. The code is made conditional on CONFIG_H264DSP
which is set by the codecs requiring it.

The qpel and chroma MC functions are not moved as these are used by...

5820b90d 03/12/2010 03:23 PM Michael Niedermayer

Fix indention

Originally committed as revision 22484 to svn://

2ce1c2e0 03/12/2010 03:21 PM Michael Niedermayer

Always reset slice_table.
Previously, the area of a lost slice would be left at the slice number of the previous
frame which could occasionally match the number of the next slice and thus a non existing
slice could have been used for prediction leading to additional decoding errors in otherwise...

3d9137c8 03/03/2010 09:10 PM Michael Niedermayer

Reorder indexes in weight tables.
5 cpu cycles faster.

Originally committed as revision 22183 to svn://

1a29c6a0 03/03/2010 07:32 PM Michael Niedermayer

cosmetic addition of {}

Originally committed as revision 22178 to svn://

70118abd 03/03/2010 02:41 PM Michael Niedermayer

Merge weight & offset tables, 15 cpu cycles faster.

Originally committed as revision 22169 to svn://

72f86ec0 03/03/2010 10:57 AM Michael Niedermayer

Simplify implicit_weight table init.

Originally committed as revision 22168 to svn://

145061a1 03/02/2010 02:24 AM Michael Niedermayer

Fix a bunch of bugs ive introduced recently that broke threaded decoding.
might also fix issue1788

Originally committed as revision 22141 to svn://

bc997376 03/01/2010 12:22 AM Aurelien Jacobs

revert r22112 which broke playback of cathedral-beta2-400extra-crop-avc.mp4

Originally committed as revision 22125 to svn://

7c994c36 02/28/2010 06:33 PM Janusz Krzysztofik

Process picture aspect ratio changes in H.264.
This fixes playback of such streams with ffplay (but does not affect
current ffmpeg).

Patch by Janusz Krzysztofik, jkrzyszt A tis D icnet D pl

Originally committed as revision 22112 to svn://

747db4e3 02/26/2010 03:27 AM Michael Niedermayer

Move init of right side of ref_cache from fill_caches() to init_the_darn_decoder().

Originally committed as revision 22071 to svn://

358b5b1a 02/25/2010 11:44 PM Michael Niedermayer

Get rid of mb2b8_xy and b8_stride, change arrays organized based on b8_stride to
ones based on mb_stride in h264.
about 20 cpu cycles faster overall per MB

Originally committed as revision 22065 to svn://

36b54927 02/25/2010 03:29 PM Michael Niedermayer

Dont allocate direct_table 8 times too large.

Originally committed as revision 22056 to svn://

662a5b23 02/25/2010 02:26 PM Michael Niedermayer

Reorder intra4x4_pred_mode so that we can read/write 4 values at once.
3-7 cpu cycles faster

Originally committed as revision 22053 to svn://

5b0fb524 02/25/2010 02:02 PM Michael Niedermayer

Store intra4x4_pred_mode per row only.
about 5 cpu cycles slower in the local code but should be overall faster
due to reduced cache use. (my sample though has too few intra4x4 blocks
for this to be meassureable easily either way)

Originally committed as revision 22052 to svn://

e1c88a21 02/25/2010 04:11 AM Michael Niedermayer

Cut the size of mvd_table by yet another factor of 2.
The code read/write code itself was 1 cycle faster, overall its
likely more due to cache effects

Originally committed as revision 22048 to svn://

d43c1922 02/25/2010 02:42 AM Michael Niedermayer

Keep mvd_table values of only 2 mb rows.

Originally committed as revision 22047 to svn://

b5bd0700 02/24/2010 08:43 PM Michael Niedermayer

Change mvd_cache & mvd_table to 8bit, this is overall a bit faster
for high resolution videos.
about 20cycles faster per MB for cathederal.

Originally committed as revision 22038 to svn://

db8cb47d 02/23/2010 01:08 AM Michael Niedermayer

Try to set has_b_frames in codec init if we know everything alraedy.
This fixes some issues with the first few timestamps.

Originally committed as revision 21976 to svn://

9855b2e3 02/23/2010 01:07 AM Michael Niedermayer

Move extradata reading code into codec init instead of doing it
in read frame.

Originally committed as revision 21975 to svn://

0cb17649 02/21/2010 07:32 PM avcoder

Remove unused variable mb_xy.

Patch by avcoder, ffmpeg gmail

Originally committed as revision 21945 to svn://

19769ece 02/18/2010 04:24 PM Måns Rullgård

H264: use alias-safe macros

This eliminates all aliasing violation warnings in h264 code.
No measurable speed difference with gcc-4.4.3 on i7.

Originally committed as revision 21881 to svn://

024bf79f 02/18/2010 12:37 PM Michael Niedermayer

Simplify deblock_left/top condition for deblocking_filter=2

Originally committed as revision 21876 to svn://

69a28f3e 02/17/2010 02:25 AM Michael Niedermayer

Move predict_field_decoding_flag() from h264.h to .c as its only used there and belongs
there as well.

Originally committed as revision 21861 to svn://

69cc3183 02/17/2010 02:14 AM Michael Niedermayer

Move check for and call of predict_field_decoding_flag() from the mb code to
the row code. This function would only be needed on a MB basis for MBAFF+FMO

Originally committed as revision 21860 to svn://

f4b8b825 02/14/2010 11:06 PM Michael Niedermayer

Merge decode_cabac_mb_dqp() with surronding code.
~20 cpu cycles faster

Originally committed as revision 21826 to svn://

94cb5994 02/14/2010 10:59 PM Michael Niedermayer

Drop if(0) code.

Originally committed as revision 21825 to svn://

78998bf2 02/13/2010 09:09 PM Alexander Strange

h264: Remove unused variables.

Originally committed as revision 21815 to svn://

02e8c5f0 02/12/2010 11:28 PM Michael Niedermayer

Dont drop B frames without last_picture.
Fixes issue1722

Originally committed as revision 21783 to svn://

3566042a 02/12/2010 07:25 PM Michael Niedermayer

Try to support truncated h264 frames mixed with mpeg pes headers in mkv.
Fixes issue1585

Originally committed as revision 21772 to svn://

055a6aa7 02/08/2010 12:08 AM Michael Niedermayer

Set x264_build so that checks are simpler.

Originally committed as revision 21681 to svn://

3102d180 02/04/2010 03:30 PM Michael Niedermayer

Fix large timebases.
Fixed issue1633

Originally committed as revision 21636 to svn://

dd0cd3d2 01/28/2010 08:57 PM Rafaël Carré

Export H264 profile and level in AVCodecContext.

Patch by Rafaël Carré, rafael D carre A gmail

Originally committed as revision 21517 to svn://

881b5b80 01/27/2010 10:22 PM Rafaël Carré

Fix svq3_* function declarations.

Patch by Rafaël Carré, rafael D carre A gmail

Originally committed as revision 21489 to svn://

aaa995d7 01/26/2010 01:30 PM Michael Niedermayer

100l typo fix, mixed up +-1 forcing the loop filter skip to never skip.

Originally committed as revision 21455 to svn://

1e4f1c56 01/25/2010 01:56 AM Alexander Strange

100l, correct wrong H.264+adaptive MBAFF decoding

Fixes several FATE tests.

Originally committed as revision 21445 to svn://

0b69d625 01/25/2010 12:30 AM Alexander Strange

H.264: Use 64-/128-bit write-combining macros for copies

2-3% faster decode on x86-32 core2.

Originally committed as revision 21440 to svn://

77d40dce 01/24/2010 05:02 PM Michael Niedermayer

Remove is_complex from loop_filter() its useless there in its current form.

Originally committed as revision 21423 to svn://

0dc343d4 01/24/2010 04:37 PM Laurent Aimar

Added a missing const to ff_h264_get_slice_type().

Originally committed as revision 21421 to svn://

50eb40a7 01/24/2010 01:20 PM Michael Niedermayer

Remove all uses of slice_type* from the loop filter, also remove its
initialization befre the loop filter.

Originally committed as revision 21416 to svn://

0c32e19d 01/23/2010 06:05 PM Michael Niedermayer

Move +52 from the loop filter to the alpha/beta offsets in the context.
This should fix a segfault, also it might be faster on systems where the
+52 wasnt free.

Originally committed as revision 21406 to svn://

7231ccf4 01/18/2010 11:55 PM Michael Niedermayer

Cosmetic, get rid of &x0

Originally committed as revision 21309 to svn://

2b3649f6 01/18/2010 11:41 PM Michael Niedermayer

Fix compilation with -O0.

Originally committed as revision 21308 to svn://

fb823b77 01/18/2010 08:19 PM Michael Niedermayer

Fix 10l segfault with threads.

Originally committed as revision 21293 to svn://

6d7e6b26 01/18/2010 05:15 AM Michael Niedermayer

Perform reference remapping at fill_cache() time instead of in the
loop filter. This removes one obstacle of getting ff_h264_filter_mb_fast()
bitexact. code is maybe 0.1% faster

Originally committed as revision 21280 to svn://

44a5e7b6 01/18/2010 12:20 AM Michael Niedermayer

Move the qp check to skip the loop filter up.

Originally committed as revision 21274 to svn://

f432b43b 01/17/2010 09:43 PM Michael Niedermayer

Split fill_caches() between filter and decoder.

Originally committed as revision 21271 to svn://

c988f975 01/17/2010 08:35 PM Michael Niedermayer

Rearchitecturing the stiched up goose part 1
Run loop filter per row instead of per MB, this also should make it
much easier to switch to per frame filtering and also doing so in a
seperate thread in the future if some volunteer wants to try.
Overall decoding speedup of 1.7% (single thread on pentium dual / cathedral sample)...

4c568cbc 01/16/2010 01:12 PM Michael Niedermayer

Consider slice_beta_offet in qp_thresh.

Originally committed as revision 21244 to svn://

2e36c931 01/16/2010 11:55 AM Michael Niedermayer

Avoid wasting 4 cpu cycles per MB in redundantly calculating qp_thresh.

Originally committed as revision 21243 to svn://

0cd73b6c 01/13/2010 02:44 AM Michael Niedermayer

remove unused variable

Originally committed as revision 21182 to svn://

cc51b282 01/13/2010 02:35 AM Michael Niedermayer

Split cabac decoding code out of h264.c.
not slower according to benchmarks.

Originally committed as revision 21181 to svn://

e1e94902 01/13/2010 01:59 AM Michael Niedermayer

Split cavlc out of h264.c.
Seems to speed the code up a little...
The placement of many generic functions between h264.c and h264.h is still open
Currently they are a little randomly placed between them.

Originally committed as revision 21178 to svn://

188d3c51 01/12/2010 09:36 PM Michael Niedermayer

Split motion vector prediction off h264.c/h.

Originally committed as revision 21174 to svn://