summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_filter.c
Commit message (Collapse)AuthorAge
* avcodec/hevc_filter: Pass HEVCLocalContext when slice-threadingAndreas Rheinhardt2022-07-25
| | | | | | | | | | | | | | | | | | | | | | | | The HEVC decoder has both HEVCContext and HEVCLocalContext structures. The latter is supposed to be the structure containing the per-slicethread state. Yet that is not how it is handled in practice: Each HEVCLocalContext has a unique HEVCContext allocated for it and each of these coincides with the main HEVCContext except in exactly one field: The corresponding HEVCLocalContext. This makes it possible to pass the HEVCContext everywhere where logically a HEVCLocalContext should be used. This commit stops doing this for lavc/hevc_filter.c; it also constifies everything that is possible in order to ensure that no slice thread accidentally modifies the main HEVCContext state. There are places where this was not possible, namely with the SAOParams in sao_filter_CTB() or with sao_pixels_buffer_h in copy_CTB_to_hv(). Both of these instances lead to data races, see https://fate.ffmpeg.org/report.cgi?time=20220629145651&slot=x86_64-archlinux-gcc-tsan-slices Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_filter: copy_CTB() only within width&heightMichael Niedermayer2022-07-22
| | | | | | | | Fixes: out of array access Fixes: 49271/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5424984922652672 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_refs: Constify ff_hevc_get_ref_list()Andreas Rheinhardt2022-07-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/thread: Move ff_thread_(await|report)_progress to new headerAndreas Rheinhardt2022-02-09
| | | | | | | | | | This is in preparation for further commits that will stop using ThreadFrame for frame-threaded codecs that don't use ff_thread_(await|report)_progress(); the API for those codecs having inter-frame depdendencies will live in threadframe.h. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_filter: Correct indentionLimin Wang2021-10-17
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/hevc_filter: remove unneeded headersLimin Wang2021-10-17
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into functionsfan52017-12-08
| | | | | | In preparation for implementation of skip_frame. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/hevc_filter: support for all skip_loop_filter levels.sfan52017-12-04
| | | | | | Continues where commit 52c75d486ed5f75cbb79e5dbd07b7aef24f3071f left off. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevc_filter: Fix invalid shiftMichael Niedermayer2017-06-21
| | | | | | | | | Fixes: runtime error: left shift of negative value -1 Fixes: 2299/clusterfuzz-testcase-minimized-4843509351710720 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '4abe3b049d987420eb891f74a35af2cebbf52144'Clément Bœsch2017-03-23
|\ | | | | | | | | | | | | * commit '4abe3b049d987420eb891f74a35af2cebbf52144': hevc: rename hevc.[ch] to hevcdec.[ch] Merged-by: Clément Bœsch <u@pkh.me>
| * hevc: rename hevc.[ch] to hevcdec.[ch]Anton Khirnov2016-10-16
| | | | | | | | | | This is more consistent with the rest of libav and frees up the hevc.h name for decoder-independent shared declarations.
* | Merge commit 'ba479f3daafc7e4359ec1212164569ebe59f0bb7'James Almer2017-03-21
|\| | | | | | | | | | | | | * commit 'ba479f3daafc7e4359ec1212164569ebe59f0bb7': hevc: Change type of array stride parameters to ptrdiff_t Merged-by: James Almer <jamrial@gmail.com>
| * hevc: Change type of array stride parameters to ptrdiff_tDiego Biurrun2016-09-29
| | | | | | | | ptrdiff_t is the correct type for array strides and similar.
* | Merge commit '4f81f8dba735c212efae077c4fec8ad4fe53b352'Clément Bœsch2016-06-29
|\| | | | | | | | | | | | | * commit '4f81f8dba735c212efae077c4fec8ad4fe53b352': Drop unnecessary golomb.h #includes Merged-by: Clément Bœsch <clement@stupeflix.com>
| * Drop unnecessary golomb.h #includesDiego Biurrun2016-06-08
| |
* | Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '059a934806d61f7af9ab3fd9f74994b838ea5eba': lavc: Consistently prefix input buffer defines Conflicts: doc/examples/decoding_encoding.c libavcodec/4xm.c libavcodec/aac_adtstoasc_bsf.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.h libavcodec/asvenc.c libavcodec/avcodec.h libavcodec/avpacket.c libavcodec/dvdec.c libavcodec/ffv1enc.c libavcodec/g2meet.c libavcodec/gif.c libavcodec/h264.c libavcodec/h264_mp4toannexb_bsf.c libavcodec/huffyuvdec.c libavcodec/huffyuvenc.c libavcodec/jpeglsenc.c libavcodec/libxvid.c libavcodec/mdec.c libavcodec/motionpixels.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/noise_bsf.c libavcodec/nuv.c libavcodec/nvenc.c libavcodec/options.c libavcodec/parser.c libavcodec/pngenc.c libavcodec/proresenc_kostya.c libavcodec/qsvdec.c libavcodec/svq1enc.c libavcodec/tiffenc.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/utvideoenc.c libavcodec/vc1dec.c libavcodec/wmalosslessdec.c libavformat/adxdec.c libavformat/aiffdec.c libavformat/apc.c libavformat/apetag.c libavformat/avidec.c libavformat/bink.c libavformat/cafdec.c libavformat/flvdec.c libavformat/id3v2.c libavformat/isom.c libavformat/matroskadec.c libavformat/mov.c libavformat/mpc.c libavformat/mpc8.c libavformat/mpegts.c libavformat/mvi.c libavformat/mxfdec.c libavformat/mxg.c libavformat/nutdec.c libavformat/oggdec.c libavformat/oggparsecelt.c libavformat/oggparseflac.c libavformat/oggparseopus.c libavformat/oggparsespeex.c libavformat/omadec.c libavformat/rawdec.c libavformat/riffdec.c libavformat/rl2.c libavformat/rmdec.c libavformat/rtpdec_latm.c libavformat/rtpdec_mpeg4.c libavformat/rtpdec_qdm2.c libavformat/rtpdec_svq3.c libavformat/sierravmd.c libavformat/smacker.c libavformat/smush.c libavformat/spdifenc.c libavformat/takdec.c libavformat/tta.c libavformat/utils.c libavformat/vqf.c libavformat/westwood_vqa.c libavformat/xmv.c libavformat/xwma.c libavformat/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/hevc: rudimentary support for skip_loop_filter.Nicolas George2015-07-23
| | | | | | | | | | | | | | | | | | +~9% speed on Core i5 on test sample. All frames are treated as ref frames, skipping only applies at level "all". The following mail contains information on how to improve that: http://ffmpeg.org/pipermail/ffmpeg-devel/2015-July/176116.html
* | Merge commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2'Michael Niedermayer2015-07-12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2': hevc: remove HEVCContext usage from hevc_ps Conflicts: libavcodec/hevc.c libavcodec/hevc_cabac.c libavcodec/hevc_filter.c libavcodec/hevc_mvs.c libavcodec/hevc_ps.c libavcodec/hevc_refs.c libavcodec/hevcpred_template.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * hevc: remove HEVCContext usage from hevc_psAnton Khirnov2015-07-12
| | | | | | | | | | | | Factor out the parameter sets into a separate struct and use it instead. This will allow us to reuse this code in the parser.
| * hevc: Use generic av_clip function, not C implementationPeter Meerwald2015-02-13
| | | | | | | | | | | | | | | | | | hevc seems to be the only place where the C implementation of the av_clip function is explicitly selected, precluding platform-specific optimizations Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | hevc/sao: use unaligned copyChristophe Gisquet2015-03-02
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc/sao: do in-place band filtering when possibleChristophe Gisquet2015-02-07
| | | | | | | | | | | | | | The copies are only needed when data must be restored, so skip them when it must not be. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | x86/hevcdsp: add ff_hevc_sao_edge_filter_8_{ssse3,avx2}James Almer2015-02-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original x86 intrinsics code and initial yasm port by Pierre-Edouard Lepere. Refactoring and optimizations by James Almer. Benchmarks of BQTerrace_1920x1080_60_qp22.bin with an Intel Core i5-4200U Width 32 158583 decicycles in edge, sao_edge_filter_8 runs, 0 skips 5205 decicycles in ff_hevc_sao_edge_filter_32_8_ssse3, 32767 runs, 1 skips 2942 decicycles in ff_hevc_sao_edge_filter_32_8_avx2, 32767 runs, 1 skips Width 64 705639 decicycles in sao_edge_filter_8, 262144 runs, 0 skips 19224 decicycles in ff_hevc_sao_edge_filter_64_8_ssse3, 262111 runs, 33 skips 10433 decicycles in ff_hevc_sao_edge_filter_64_8_avx2, 262115 runs, 29 skips Signed-off-by: James Almer <jamrial@gmail.com>
* | hevcdsp: remove compilation-time-fixed parameter from sao_edge_filterJames Almer2015-02-05
| | | | | | | | | | | | The stride_src parameter is always 2 * MAX_PB_SIZE + FF_INPUT_BUFFER_PADDING_SIZE. Signed-off-by: James Almer <jamrial@gmail.com>
* | hevcdsp: replace the SAOParams struct parameter from sao_edge_filterJames Almer2015-02-04
| | | | | | | | | | | | | | | | As with sao_band_filter, pass instead the two variables from the struct needed in the function. This simplifies writing asm optimized versions. Reviewed-by: Mickaël Raulet <mraulet@insa-rennes.fr> Signed-off-by: James Almer <jamrial@gmail.com>
* | hevcdsp: simplified sao_edge_filterSeppo Tomperi2015-02-04
| | | | | | | | | | Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com> Reviewed-by: Mickaël Raulet <mraulet@insa-rennes.fr>
* | hevcdsp: separated sao edge filter and pixel restore funcsSeppo Tomperi2015-02-04
| | | | | | | | | | | | Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com> Reviewed-by: Mickaël Raulet <mraulet@insa-rennes.fr>
* | avcodec/hevc: Update the USE_SAO_SMALL_BUFFER case for the alignment ↵Christophe Gisquet2015-02-04
| | | | | | | | | | | | | | | | | | | | | | | | requirements in FFmpeg Use edge emu buffers And enable the code unconditionally Speed difference without USE_SAO_SMALL_BUFFER and with the new code: Decicycles: 26772->26220 (BO32), 83803->80942 (BO64) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/hevc: reduce memory for SAOFabrice Bellard2015-02-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cherry picked from commit 5d9f79edef2c11b915bdac3a025b59a32082f409 SAO edge filter uses pre-SAO pixel data on the left and top of the ctb, so this data must be kept available. This was done previously by having 2 copies of the frame, one before and one after SAO. This commit reduces the storage to just that, instead of the previous whole frame. Commit message taken from patch by Christophe Gisquet <christophe.gisquet@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/hevc_filter: Fix indentionMichael Niedermayer2015-02-02
| | | | | | | | | | Found-by: Timothy Gu <timothygu99@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/hevc: adding support for monochrome sequences in hevcMickaël Raulet2015-02-02
| | | | | | | | | | | | cherry picked from commit 8e50557707d2ec11ccad657470b2e140f314348e Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc/sao: use aligned copiesChristophe Gisquet2015-02-01
| | | | | | | | | | | | | | | | | | | | | | For band filter, source and destination are aligned (except for 16x16 ctbs), and otherwise, they are most often aligned. Overall, the total width is also too small for amortizing memcpy. Timings (using an intrinsic version of edge filters): B/32 B/64 E/32 E/64 Before: 32045 93952 38925 126896 After: 26772 83803 33942 117182
* | x86/hevc: add ff_hevc_sao_band_filter_{8,10,12}_{sse2,avx,avx2}James Almer2015-02-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original x86 intrinsics code and initial 8bit yasm port by Pierre-Edouard Lepere. 10/12bit yasm ports, refactoring and optimizations by James Almer Benchmarks of BQTerrace_1920x1080_60_qp22.bin with an Intel Core i5-4200U width 32 40338 decicycles in sao_band_filter_0_8, 2048 runs, 0 skips 8056 decicycles in ff_hevc_sao_band_filter_8_32_sse2, 2048 runs, 0 skips 7458 decicycles in ff_hevc_sao_band_filter_8_32_avx, 2048 runs, 0 skips 4504 decicycles in ff_hevc_sao_band_filter_8_32_avx2, 2048 runs, 0 skips width 64 136046 decicycles in sao_band_filter_0_8, 16384 runs, 0 skips 28576 decicycles in ff_hevc_sao_band_filter_8_32_sse2, 16384 runs, 0 skips 26707 decicycles in ff_hevc_sao_band_filter_8_32_avx, 16384 runs, 0 skips 14387 decicycles in ff_hevc_sao_band_filter_8_32_avx2, 16384 runs, 0 skips Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* | hevcdsp: replace the SAOParams struct parameter from sao_band_filterJames Almer2015-02-01
| | | | | | | | | | | | | | Pass instead the two variables from the struct needed in the function. This simplifies writing asm optimized versions of the function Signed-off-by: James Almer <jamrial@gmail.com>
* | hevcdsp: remove unused parameter from sao_band_filterJames Almer2015-02-01
| | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit '7acdd3a1275bcd9cad48f9632169f6bbaeb39d84'Michael Niedermayer2014-08-09
|\| | | | | | | | | | | | | | | | | | | * commit '7acdd3a1275bcd9cad48f9632169f6bbaeb39d84': hevc_filter: avoid excessive calls to ff_hevc_get_ref_list() Conflicts: libavcodec/hevc_filter.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hevc_filter: avoid excessive calls to ff_hevc_get_ref_list()Anton Khirnov2014-08-09
| | | | | | | | | | | | | | | | 1) each of the loops run within a single CTB, so the relevant reference list is constant 2) when that CTB is, or lies on the same slice as, the current one, we can use a simple access instead of a relatively expensive call to ff_hevc_get_ref_list()
* | Merge commit 'a7a17e3f1915ce69b787dc58c5d8dba0910fc0a4'Michael Niedermayer2014-08-09
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'a7a17e3f1915ce69b787dc58c5d8dba0910fc0a4': hevc_filter: move some conditions out of loops Conflicts: libavcodec/hevc_filter.c This is possibly less readable than the variant used before. Thus please take a look and if people agree its worse, dont hesitate to revert. See: 83976e40e89655162e5394cf8915d9b6d89702d9 Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hevc_filter: move some conditions out of loopsAnton Khirnov2014-08-09
| |
| * hevc: deobfuscate slice/tile boundary handling for DBFAnton Khirnov2014-08-09
| | | | | | | | | | Use named constants instead of magic numbers, avoid using variables with inverse meaning from what their name implies.
| * hevc_filter: drop more redundant checksAnton Khirnov2014-08-09
| | | | | | | | The if() around those loops ensures this condition is always false.
| * hevc_filter: drop redundant checksAnton Khirnov2014-08-09
| | | | | | | | | | ff_hevc_deblocking_boundary_strengths() is never called if the deblocking filter is disabled for the slice.
* | hevc_deblock: change tc typeChristophe Gisquet2014-08-06
| | | | | | | | | | | | | | The x86 asm expects int32_t so use that type. Reviewed-by: Mickaël Raulet <mraulet@insa-rennes.fr> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc_filter: run vertical and horizontal togetherChristophe Gisquet2014-07-29
| | | | | | | | | | | | | | | | This should help cache locality. On win64: Before: 1397x cycles, 16216 bytes After: 1369x cycles, 16040 bytes Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc: rename variable in boundary strength to b more explicitAnton Khirnov2014-07-28
| | | | | | | | | | | | | | Signed-off-by: Mickaël Raulet <mraulet@insa-rennes.fr> cherry picked from commit 348bebedc0012aae201419669fca1eb61ec93ca6 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc: remove non necessary parameters to ff_hevc_set_qpyMickaël Raulet2014-07-28
| | | | | | | | | | | | cherry picked from commit 6f58c111ad9920d983bb18eacf901193bac5d937 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '73bb8f61d48dbf7237df2e9cacd037f12b84b00a'Michael Niedermayer2014-07-26
|\| | | | | | | | | | | | | | | | | | | | | * commit '73bb8f61d48dbf7237df2e9cacd037f12b84b00a': hevcdsp: remove an unneeded variable in the loop filter Conflicts: libavcodec/hevc_filter.c See: d7e162d46b4a0fc03ca5161cdcac840152f048cb Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hevcdsp: remove an unneeded variable in the loop filterAnton Khirnov2014-07-26
| | | | | | | | beta0 and beta1 will always be the same
* | hevcdsp: remove an unneeded variable in the loop filterAnton Khirnov2014-07-22
| | | | | | | | | | | | | | | | | | beta0 and beta1 will always be the same within a CU Signed-off-by: Mickaël Raulet <mraulet@insa-rennes.fr> cherry picked from commit 4a23d824741a289c7d2d2f2871d1e2621b63fa1b Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc/rext: update boundary strength for chroma deblocking filterMickaël Raulet2014-07-22
| | | | | | | | | | | | cherry picked from commit 7d05c95ac5a63d7675bf645e74b4cf1fffff4796 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>