1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-29 16:23:10 +02:00

Merge commit 'a22ae9f0c579793f411e2bd7a8db557091a3a4ae'

* commit 'a22ae9f0c579793f411e2bd7a8db557091a3a4ae':
  mpegts: Remove one 64-bit integer modulus operation per packet

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-08-06 16:14:33 +02:00
commit 0df55e1ba8
2 changed files with 13 additions and 1 deletions

View File

@ -195,6 +195,15 @@ if ((y) < (x)) {\
# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
#endif /* FASTDIV */
#ifndef MOD_UNLIKELY
# define MOD_UNLIKELY(modulus, dividend, divisor, prev_dividend) \
do { \
if ((prev_dividend) == 0 || (dividend) - (prev_dividend) != (divisor)) \
(modulus) = (dividend) % (divisor); \
(prev_dividend) = (dividend); \
} while (0)
#endif
static inline av_const unsigned int ff_sqrt(unsigned int a)
{
unsigned int b;

View File

@ -29,6 +29,7 @@
#include "libavutil/avassert.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/mathops.h"
#include "avformat.h"
#include "mpegts.h"
#include "internal.h"
@ -99,6 +100,8 @@ struct MpegTSContext {
int raw_packet_size;
int pos47;
/** position corresponding to pos47, or 0 if pos47 invalid */
int64_t pos;
/** if true, all pids are analyzed to find streams */
int auto_guess;
@ -1857,7 +1860,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
return 0;
pos = avio_tell(ts->stream->pb);
ts->pos47= pos % ts->raw_packet_size;
MOD_UNLIKELY(ts->pos47, pos, ts->raw_packet_size, ts->pos);
if (tss->type == MPEGTS_SECTION) {
if (is_start) {