summaryrefslogtreecommitdiffstats
path: root/libhb/decavcodec.c
Commit message (Collapse)AuthorAgeFilesLines
* libhb: fix small leaksJohn Stebbins2016-12-141-2/+6
| | | | fixes various context leaks in error conditions
* Select the appropriate coefficients for yuv<->rgb conversions.Damiano Galassi2016-11-081-61/+74
|
* libhb: rename some masks to better reflect their purpose.Tim Walker2016-09-171-1/+1
|
* libhb: use the new keyframe flag.Tim Walker2016-09-171-4/+10
|
* sync: correct timestamp discontinuities in sync instead of reader (#192)John Stebbins2016-05-241-398/+345
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* sync: move chapter logging to sync.cJohn Stebbins2016-05-171-22/+0
|
* move cadence (Film->Video) logging to sync.cJohn Stebbins2016-05-171-91/+0
|
* libhb: remove unused hb_buffer_t sequence numberJohn Stebbins2016-05-171-10/+8
|
* decavcodec: remove unused frame_duration_setJohn Stebbins2016-05-171-5/+0
|
* decavcodec: cosmeticsJohn Stebbins2016-05-171-5/+5
|
* libhb: send initial chapter through pipelineJohn Stebbins2016-05-171-8/+0
| | | | | Eliminate the need for everyone to assume that the first chapter starts at the first frame.
* remove dxva hw decode (#189)John Stebbins2016-05-171-203/+48
| | | | | | | | | * remove dxva hw decode It provides practically no speed increase even on a slow CPU and results in a speed decrease on fast CPUs. And the code is exceptionally fugly. * cli: remove USE_HWD
* decavcodec: fix audio decoder frame countJohn Stebbins2016-04-211-0/+5
| | | | it was always 0
* decavcodec: cosmeticsJohn Stebbins2016-03-231-9/+19
|
* decavcodec: recompute frame duration for every frameJohn Stebbins2016-02-281-2/+3
| | | | It can change mid-stream
* sync: gut and rewriteJohn Stebbins2016-01-211-0/+1
| | | | | | | | | | | 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: use LL for int64 constants to make mingw happyJohn Stebbins2015-12-261-7/+7
|
* decavcodec: don't try to memset NULL buffersJohn Stebbins2015-11-061-2/+8
|
* decavcodec: fix hang in avcodec decoderJohn Stebbins2015-11-061-0/+10
| | | | | libavcodec/mpeg12dec.c expects input buffers to be zero padded to 32 bit alignment. If not zero padded, it can get caught in an infinite loop.
* libhb: don't use deprecated AVPictureJohn Stebbins2015-10-291-4/+4
| | | | | libav just deprecated AVPicture and all av_picture_*/avpicture_* functions.
* libhb: add hb_buffer_listJohn Stebbins2015-09-241-84/+53
| | | | | This brings together several independent implementations of a simple buffer list manager.
* libhb: Clock/frame rate handling improvements.Bradley Sepos2015-09-101-2/+5
| | | | | | | | Allows for arbitrary frame rates between 1 and 1000 fps. Adds min/max frame rates to CLI help. Removes hardcoded instances of the internal clock rate in favor of hb_video_framerate_get_limits(). Unfortunately, much of the codebase generally refers to clock rate as frame rate, so a little extra care is still necessary going forward.
* DXVA2: cleanup decode support checks.Rodeo2015-06-231-2/+16
| | | | | | | This should fix https://forum.handbrake.fr/viewtopic.php?f=11&t=32520 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7310 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Use a buffer flat to indicate EOFjstebbins2015-05-011-6/+6
| | | | | | | | | | | | ... 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
* libhb: Eliminate global variable hb_gui_use_hwd_flagjstebbins2015-03-291-1/+1
| | | | | | | | | | | | This global was shared between the CLI and libhb and used as a back door to force scan and encode passes to use the same ffmpeg context for hardware decoding. Aside from the fact that this context sharing should not be necessary and needs fixing, this information belongs in the hb_handle_t that is shared between the scan and the encode. So put it there and make sure the hb_handle_t get propagated to where the flag is needed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7028 b64f7644-9d1e-0410-96f1-a4d463321fa5
* New audio output options.Rodeo2015-02-151-12/+11
| | | | | | | | | Dolby Digital Plus (E-AC-3), Dolby TrueHD and FLAC can now be passed through without re-encoding. They aren't covered by Auto Passthru yet, however. In addition, encoding to E-AC-3 is now possible. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6908 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Fix AAC passthru from TS filesjstebbins2015-02-041-1/+29
| | | | | | | | | | Apply aac_adtstoasc bitstream filter while muxing AAC stream and extract AudioSpecificConfig during scan. Patch submitted by Taihei Momma git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6867 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
* json: fix building with --enable-hwdjstebbins2014-12-181-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6607 b64f7644-9d1e-0410-96f1-a4d463321fa5
* json: add json APIsjstebbins2014-12-161-21/+21
| | | | | | | | | | There are several changes to job and title structs that break current windows interop code. The interop code should be changed such that it only uses json APIs. So if there is any missing features (or bugs) in these APIs, please let me know. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6602 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: enable crc checking of audio streams during audio parameter probejstebbins2014-11-051-2/+7
| | | | | | | | | We used to check ac3 crc's when we used a52 dec. When we switched to libav we did not enable crc checks. I suspect this is the root cause of this problem https://forum.handbrake.fr/viewtopic.php?f=12&t=31032 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6507 b64f7644-9d1e-0410-96f1-a4d463321fa5
* decavcodec: fix a 4 byte overread of extradata by libavjstebbins2014-10-291-1/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6480 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: improve preview generateion when there are no IDRsjstebbins2014-10-021-0/+25
| | | | | | | | | | Puts the decoder into a mode that returns *all* frames. I.e. it won't just scan to the end of the file looking for an IDR. Then we decode multiple frames (up to 100) searching for an I frame. This way, the reconstructed frame we use for a preview is more likely to be complete. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6430 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: simplify avcodec extradata parsingjstebbins2014-10-021-75/+21
| | | | | | | | | Use avcodec parser->split() instead of writing our own parser. This makes extradata parsing work for stream formats other than vc1 if the need should ever arise. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6429 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: plug memory leaksjstebbins2014-09-051-0/+3
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6394 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Improve handling of streams with broken video timestampsjstebbins2014-07-161-4/+11
| | | | | | | Addresses https://forum.handbrake.fr/viewtopic.php?f=12&t=30307&p=140045#p139847 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6235 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Fix decoding avi with palettejstebbins2014-05-291-0/+18
| | | | | | | | | ... and probably other formats that use a palette. The palette is stored in AVPacket side data which we did not read. So read the side data and stash it in hb_buffer_t so that it can be used later by the decoder. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6207 b64f7644-9d1e-0410-96f1-a4d463321fa5
* enc_qsv: general cleanup.Rodeo2014-04-051-1/+0
| | | | | | | | | | | | | | | | | Mainly: - coding style - formatting - indentation Also: - fix two warnings - remove unnecessary header - remove unused parameter in parse_nalus git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6145 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix decavcodecaBSInfo again...jstebbins2014-02-221-16/+24
| | | | | | | ... forgot to check for error return from avcodec_decode_audio4 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6055 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix a problem decoding wmapro audiojstebbins2014-02-221-3/+3
| | | | | | | ... and probably some other audio types. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6054 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: remove a52decjstebbins2014-02-201-1/+13
| | | | | | | replace it with libavcodec ac3 decoder git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6049 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
* QSV: API 1.8 support and related improvementsRodeo2014-02-181-14/+19
| | | | | | | | | Optional feature detection now done via MFXVideoENCODE_Query. This should work better with future hardware and encoder implementations. Optional API 1.8 features are not tested (not supported by the software implementation, and no drivers with API 1.8 support available yet). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6041 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Bump libav to v10_beta1Rodeo2014-02-181-0/+23
| | | | | | | | | Remove some patches that have been applied upstream. Add support for AVDownmixInfo side data (i.e. mix levels). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6039 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix problem with avcodec audio sample_ratejstebbins2014-02-021-2/+21
| | | | | | | | libavcodec does not yet consistently set AVFrame.sample_rate. So when it is not set, use AVCodecContext.sample_rate and log a warning. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6011 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix crashes with some BDsjstebbins2014-01-311-0/+3
| | | | | | | | A stray line of code from the switch from mpeg2dec to libavcodec caused a failure to open the mpeg2 decoder for BDs git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6009 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Replace invaled timestamp flag "-1" with AV_NOPTSjstebbins2014-01-261-5/+3
| | | | | | | | | -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: support AV_FRAME_DATA_MATRIXENCODING side data.Rodeo2014-01-261-1/+21
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6000 b64f7644-9d1e-0410-96f1-a4d463321fa5
* decavcodec: DRC support.Rodeo2014-01-251-0/+42
| | | | | | | Adds DRC support for E-AC-3 audio (as well as any future libavcodec decoders with DRC support). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5995 b64f7644-9d1e-0410-96f1-a4d463321fa5