summaryrefslogtreecommitdiffstats
path: root/libhb/fifo.c
Commit message (Collapse)AuthorAgeFilesLines
* opencl: removit it (#777)John Stebbins2017-06-121-90/+9
| | | | It was only used for scaling, it fails far too often and is only faster on a limited selectoin of hardware.
* Update copyright dates to 2017.Bradley Sepos2017-01-011-1/+1
|
* qsv: rename av_qsv* to hb_qsv*John Stebbins2016-12-171-4/+4
|
* qsv: fix more compiler warningsJohn Stebbins2016-12-171-1/+1
|
* libhb: fix build with --enable-qsvTim Walker2016-12-171-1/+1
| | | | | | | | | | Convert qsv_livav.[ch] to be built within libhb. Convert other files to use qsv_libav.h in place of libavcodec/qsv.h Don't attempt to build libav with QSV support (not available in unpatched release/11 branch). QSV-accelerated decoding is broken, so disable it for the time being.
* fifo: fix log messageJohn Stebbins2016-09-201-1/+1
|
* libhb: fix memory leakJohn Stebbins2016-09-091-1/+1
| | | | code commented out during a debug session got unintentionally committed
* sync: correct timestamp discontinuities in sync instead of reader (#192)John Stebbins2016-05-241-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sync: correct timestamp discontinuities in sync instead of reader This patch passes discontinuity information through the pipeline till it reaches sync.c. The timestamps are passed through the pipeline as read and unmodified to sync.c (instead of attempting to correct discontinuities in reader). In sync, when we see a discontinuity, we know where the next timestamp should be based on the timestamp and duration of the previous buffer (before the discontinuity). So we calculate an "SCR" offset based on the timestamp after the discontinuity and what we calculate it should be. The old discontinuity handling code was broken due to the following. The MPEG STD timing model relies heavily on the decoder having an STC that is phase lock looped to the PCRs in the stream. When decoding a broadcast stream, the decoder can count on the time measure between PCRs using the STC to match to a high degree of accuracy. I.e. STC - lastSTC == PCR - lastPCR. When a discontinuity occurs, the decoder calculates a new PCR offset = PCR - STC. I.e. the offset is the new PCR value minus what it would have been if there had been no discontinuity. The above does not work without a reliable STC, which we do not have. We have been attempting to approximate one by avereraging the duration of received packets and extrapolating an "STC" based on the last PTS and the average packet duration. But this is highly variable and unreliable. * decavcodec: fix data type of next_pts It needs to be double so that partial ticks are not lost * deccc608sub: clarify comment * sync: allow queueing more audio Audio is small, and there is often a significant amount of audio in the stream before the first video frame. * sync: improve handling of damaged streams When data is missing, the audio decoder was extrapolating timestamps from the last pts before the error caused by the missing data which caused sync issues. Also, missing data can cause the video decoder to output a frame out of order with the wrong scr sequence. Drop such frames.
* buffers: add more buffer allocation debuggingJohn Stebbins2016-05-171-0/+31
|
* buffers: add more buffer debugging supportJohn Stebbins2016-04-201-7/+33
|
* fifo: when HB_BUFFER_DEBUG is set, memset buffers to 0John Stebbins2016-03-231-0/+6
|
* sync: gut and rewriteJohn Stebbins2016-01-211-0/+26
| | | | | | | | | | | sync.c was difficult to read, fragile, and prone to difficult to diagnose bugs (see https://forum.handbrake.fr/viewtopic.php?f=12&t=33147) This rewrite simplifies the code, removes signals, locking and yield that probably cause the above problem and is much more flexible. It fixes a wider variety of timestamp issues than before and is much easier to extend if other timestamp analysis is desired.
* Update copyright dates to 2016.Bradley Sepos2016-01-011-1/+1
|
* libhb: remove unused hb_buffer_t.subJohn Stebbins2015-09-041-38/+0
|
* libhb: Use a buffer flat to indicate EOFjstebbins2015-05-011-0/+7
| | | | | | | | | | | | ... instead of a 0 length buffer. This fixes this issue: https://forum.handbrake.fr/viewtopic.php?f=12&t=31959 Theora can create 0 length output. These 0 length frames indicate duplicate frames. So we can't use 0 length buffers to indicate the end of the stream. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7143 b64f7644-9d1e-0410-96f1-a4d463321fa5
* sync: fix frame p-to-p extra audio after end framejstebbins2015-04-221-0/+18
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7119 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Update year to 2015.bradleys2015-02-011-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6852 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: add hb_image_init to create blank imagesjstebbins2014-12-191-0/+80
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6613 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fifo: add code (ifdef'd out) to assist with finding buffer leaksjstebbins2014-10-301-0/+33
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6485 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: add new function for retrieving previewsjstebbins2014-07-291-0/+52
| | | | | | | | | | | | | | | | This new function has a couple advantages over the old one (which we should phase out). It does not require hb_job_t as a parameter, instead it uses hb_ui_geometry_t which is a smaller and simpler struct. The entire job struct is overkill as input to this function. It returns an hb_image_t that fully describes the returned image instead of just a uint8_t array. The caller does not have to make assumptions about image size, line stide, or pixel format since hb_image_t specifies these things. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6242 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Update some copyright dates to 2014.Rodeo2014-02-181-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6042 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Replace invaled timestamp flag "-1" with AV_NOPTSjstebbins2014-01-261-6/+6
| | | | | | | | | -1 is not a good value as a flag for invalid timestamps. There are cases where small negative timestamps are useful. So this eliminates a potential ambiguity. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6001 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: use av_pix_fmt_desc_getjstebbins2014-01-061-3/+3
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5954 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix a bunch of compiler warningsjstebbins2013-11-261-7/+15
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5905 b64f7644-9d1e-0410-96f1-a4d463321fa5
* OpenCL: use the new library loading architecture for all OpenCL code.Rodeo2013-11-081-46/+55
| | | | | | | | | | | An OpenCL SDK is no longer needed to build OpenCL support. Note: as a result, the --enable-opencl configure option is removed. Also, libOpenCL is no longer needed to run the application (it is still necessary to use OpenCL features, of course). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5886 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Plug some leaks and clean up the buffer pool code a little.jstebbins2013-10-231-9/+17
| | | | | | | | | | | Filters were leaking buffers when a job is cancelled. decavcodec could leak when job cancelled. decavcodec leaked audio extradata in BSInfo encavcodec and encavcodecaudio leaked AVCodecContext sync leaked subtitle_sanitizer_t data git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5853 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Merging-in the OpenCL Scaling code from the OpenCL branch to trunk. sr552013-09-211-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | Patch originally by the Multicoreware Inc team, followed by improvements and fixes by Micheal Wootton from AMD Inc, OpenCL: This patch implements Bicubic Scaling in OpenCL. Note that HandBrake currently uses Lanczos so the performance difference appears to be much more significant. We may offer an option of BiCubic in software later. Bicubic scaling may appear a bit sharper than the equivalent Lanczos encode and may increase file size a bit. Quality may be better or worse depending on the scaling and content and personal preference towards sharpness. When comparing performance with a custom HandBrake build that runs Software Bicubic to OpenCL Bicubic, performance increase is about 5~7% on average on a modern GPU. Hardware Decode via DXVA: We also have optional DXVA decoding which may come in useful for slower/lower end systems that have a capable GPU. This is only available on input sources that use the libav decode path. Most GPU hardware for decoding is designed for playback, so if you are running on a high end CPU, it will bottleneck the encode process. Requires OpenCL 1.1 or later supporting GPU. Front end changes and testing framework are not included in this patch. This will be resolved later. Patch will be revised further before the UI is implemented. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5792 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Big merge, QSV to trunk: part 1 (tracked files).Rodeo2013-08-221-2/+11
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5737 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: add experimental avformat muxer for mkv and mp4jstebbins2013-06-301-0/+6
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5620 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Updated all the copyright headers to 2013.sr552013-03-091-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5318 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix a collection of small memory leaksjstebbins2012-09-131-2/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4963 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Revert temporary code that silences valgrind warningsjstebbins2012-09-121-2/+0
| | | | | | | | memsets silence silly valgrind warnings, but we don't want them in "production" git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4962 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix potential invalid memory access in decomb (again)jstebbins2012-09-121-0/+2
| | | | | | | | I missed a spot where an even wider left/right margin is needed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4961 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: decomb and deinterlace improvementsjstebbins2012-08-271-1/+18
| | | | | | | | | | | | | | | | | | Use hb_buffer_t for reference buffers. This is what eliminates extra buffer copies. Simplified a lot of the code. This resulted in some minor speed improvements and easier to read code. Allow mcdeint+bob. Previously these could not be used together. Thread the erode-dilate-erode-check steps in decomb3. More speed improvement. Speed of default decomb went from 62fps to 76fps. Speed of fast decomb went from 90fps to 95fps. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4919 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix deinterlace fast problem with sources that have <mod8 alignmentjstebbins2012-06-251-6/+7
| | | | | | | | | | avpicture_deinterlace requires that both width and height of the input be 8 pixel aligned. Video buffers already have padding to align horizontally to 16 pixels, but they were not padded vertically. This adds vertical padding. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4776 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Updated file copyright / GPL headerssr552012-06-151-3/+6
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4737 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix cfr encodingjstebbins2012-03-311-0/+138
| | | | | | | | | | | | when frames are duplicated, the frame was not copied properly and resulted in divide by 0 later when the frame is processed. This fix is a bit larger than the minimum size necessary to fix the problem. I took the oportunity to clean up some buffer initialization and copy operations. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4563 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Rework filter pipelinejstebbins2012-03-271-6/+11
| | | | | | | | | | | | | | | | | | | | This patch enhances the filter objects. The 2 key improvements are: 1. A filter can change the image dimensions as frames pass through it. 2. A filter can output more than one frame. In addition, I have: Moved cropping & scalling into a filter object Added 90 degree rotation to the rotate filter Moved subtitle burn-in rendering to a filter object. Moved VFR/CFR handling into a framerate shaping filter object. Removed render.c since all it's responsibilities got moved to filters. Improves VOBSUB and SSA subtitle handling. Allows subtitle animations. SSA karaoke support. My apologies in advance if anything breaks ;) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4546 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add utilities for debugging fifo and buffer poolsjstebbins2011-12-211-0/+166
| | | | | | | They are all ifdef'd out and not used anywhere. Enable and use as needed when fifo issues crop up. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4381 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix out of memory condition on mingw32jstebbins2011-11-151-7/+4
| | | | | | | | | realloc doesn't really release memory under most circumstances, so it's not suitable for reducing the size of an hb_buffer_t. So instead, allocate a new smaller buffer, copy the data, and return the old larger buffer to the buffer pool for reuse. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4353 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix interleaving of subtitles in muxerjstebbins2011-11-141-0/+15
| | | | | | | | | | | | | Specifically, this affects closed captions which are pushed into the pipeline very late. CC's are dribbled in 2 bytes per video frame. The entire CC that we put into a subtitle frame isn't available till we see the signal for the end of the CC. This can be several seconds after it began. So I have established a minimum buffer size that the muxer accumulates before it outputs any data. This allows CCs to get into the pipeline before the muxer outputs the interleave interval that they belong in. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4351 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Improve mpeg PS supportjstebbins2011-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | Adds support for MPEG-1 PS, HDDVD EVOB, and video codecs other than mpeg1/2 in PS Improves probing of unknown stream types by using Libav's probing utilities Use Libav to probe for dts profile in TS and PS files when profile is unknown Improves framerate detection (improved telecine detection) Fixes preview generation for mpeg video that has only a single sequence header Patches Libav to handle VC-1 pulldown flags properly Improve PS and TS stream log information git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4220 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add support for TrueHD and DTS-HD from BD sourcesjstebbins2011-04-221-2/+8
| | | | | | | | | | | | | | TrueHD and DTS-HD now show up in the audio list along side their AC-3 and DTS counterparts. Note that currently the DTS-HD decoder we are using (ffmpeg) discards the HD portion of the stream and onle decodes the DTS core portion. So there is no advantage yet to using the DTS-HD stream. In the future I would like to add DTS-HD passthru support and hopefully ffmpeg will improve their DTS-HD decoder. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3950 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Simplify a lot of subtitle handling code.jstebbins2011-03-271-2/+2
| | | | | | | Makes it easier to read. Gets rid of some unnecessary variables. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3886 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix PFR issue where there are different number of frames in 1st and 2nd pass.jstebbins2011-02-281-2/+2
| | | | | | | | | | | | | | | | | Waiting for a fill threshhold in the fifos causes some non-determinism in finding the first PTS value. Sometimes the fill level of one fifo would not be reached until after another fifo is completely full, causing an early exit in the loop that looks for the first PTS. When the initial PTS is different between passes, the duration of the first frame is different. This affects the PFR algorithm and can cause it to drop a different number of frames. The fill level was initially intended as a way to prevent thrashing between threads to improve performance. But my testing indicates no degradation when removing it. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3819 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add temporally overlapping subtitle support.davidfstr2011-02-251-0/+35
| | | | | | | | | | | | | | | | | * New subtitle sync algorithm added to sync work-object ("simultaneous"). Classic algorithm preserved but disabled. * Render work-object now supports queueing a /list/ of subtitles. * FIFOs have been extended to support pushing/popping buffer-lists as single elements. * Added SUBSYNC_VERBOSE_TIMING flag to debug timing issues related to subtitle display. Observable behaviors changed in the new subtitle sync algorithm: * Temporally overlapping subtitles are no longer trimmed to be non-overlapping. * Subtitles less than two seconds long are no longer artificially extended. Sorry, Indochine fans. * Subtitles that stop before they start will never be displayed. The old algorithm will display such subtitles if they begin in the future (relative to the current video frame being processed). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3804 b64f7644-9d1e-0410-96f1-a4d463321fa5
* plug some memory leaks.jstebbins2011-02-121-8/+12
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3797 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add Bluray supportjstebbins2010-09-081-6/+11
| | | | | | | | | | | | | | | | | | Unencrypted BD directory trees only. Doesn't support iso images. Also, no PGS subtitle support yet. Chapters and angles are supported. Adds a new contrib libbluray. Adds new option to hb_scan() for duration of short titles to filter. This applies to BD and DVD multi-title scans only. Does not apply to any single title scans. Fixes memory leak during scan. hb_buffer_close() was not freeing all buffers in a chain of buffers passed to it. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3510 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix audio detection problem during scan of ffmpeg audio sourcesjstebbins2010-04-021-0/+17
| | | | | | | | | | | | audio frames can be larger than their container packet sizes, but during scan, we only feed one container packet to the decoder, then reset the decoder and try the next packet. so the audio is never detected. as buffers are tested, they are added to a cache. the entire cache is passed to the decoder to scan for info. the cache is limited to 4KB. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3195 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix potential runaway buffer usagejstebbins2009-12-151-0/+15
| | | | | | | | | | pthread_cond_timedwait can wake early. under certain system load conditions, this happens often. I was going ahead and adding buffers whenever it woke, regardless of whether the condition had actually been met. so the fifo depth would increase until memory ran out. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3030 b64f7644-9d1e-0410-96f1-a4d463321fa5