summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-31 13:17:18 +0100
committerwm4 <wm4@nowhere>2019-10-31 13:17:18 +0100
commitc10ba5eb8e62d04ed80cad512cf4863dadee07f1 (patch)
tree8cc891e80e09617b577ae6ec92a00ad2e721d202
parent7510ed6f684041db643c051cb17b13abf663b3b2 (diff)
downloadmpv-c10ba5eb8e62d04ed80cad512cf4863dadee07f1.tar.bz2
mpv-c10ba5eb8e62d04ed80cad512cf4863dadee07f1.tar.xz
Use mp_log2() instead of av_log2()
-rw-r--r--misc/bstr.c4
-rw-r--r--video/out/bitmap_packer.c8
-rw-r--r--video/zimg.c6
3 files changed, 7 insertions, 11 deletions
diff --git a/misc/bstr.c b/misc/bstr.c
index 4117514457..772ca9c66d 100644
--- a/misc/bstr.c
+++ b/misc/bstr.c
@@ -22,8 +22,6 @@
#include <stdint.h>
#include <stdlib.h>
-#include <libavutil/common.h>
-
#include "mpv_talloc.h"
#include "common/common.h"
@@ -272,7 +270,7 @@ int bstr_parse_utf8_code_length(unsigned char b)
{
if (b < 128)
return 1;
- int bytes = 7 - av_log2(b ^ 255);
+ int bytes = 7 - mp_log2(b ^ 255);
return (bytes >= 2 && bytes <= 4) ? bytes : -1;
}
diff --git a/video/out/bitmap_packer.c b/video/out/bitmap_packer.c
index 4f7739f514..a79446d2c2 100644
--- a/video/out/bitmap_packer.c
+++ b/video/out/bitmap_packer.c
@@ -24,8 +24,6 @@
#include <stdio.h>
#include <limits.h>
-#include <libavutil/common.h>
-
#include "mpv_talloc.h"
#include "bitmap_packer.h"
#include "common/common.h"
@@ -51,7 +49,7 @@ void packer_get_bb(struct bitmap_packer *packer, struct pos out_bb[2])
#define HEIGHT_SORT_BITS 4
static int size_index(int s)
{
- int n = av_log2_16bit(s);
+ int n = mp_log2(s);
return (n << HEIGHT_SORT_BITS)
+ ((- 1 - (s << HEIGHT_SORT_BITS >> n)) & ((1 << HEIGHT_SORT_BITS) - 1));
}
@@ -148,9 +146,9 @@ int packer_pack(struct bitmap_packer *packer)
ymax = MPMAX(ymax, in[i].y);
}
if (xmax > packer->w)
- packer->w = 1 << (av_log2(xmax - 1) + 1);
+ packer->w = 1 << (mp_log2(xmax - 1) + 1);
if (ymax > packer->h)
- packer->h = 1 << (av_log2(ymax - 1) + 1);
+ packer->h = 1 << (mp_log2(ymax - 1) + 1);
while (1) {
int used_width = 0;
int y = pack_rectangles(in, packer->result, packer->count,
diff --git a/video/zimg.c b/video/zimg.c
index 6e3a72a403..9b4aa0cbaa 100644
--- a/video/zimg.c
+++ b/video/zimg.c
@@ -15,7 +15,7 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <libavutil/common.h>
+#include <math.h>
#include "common/common.h"
#include "common/msg.h"
@@ -452,8 +452,8 @@ static bool setup_format(zimg_image_format *zfmt, struct mp_zimg_repack *r,
zfmt->width = fmt.w;
zfmt->height = fmt.h;
- zfmt->subsample_w = av_log2(desc.chroma_w);
- zfmt->subsample_h = av_log2(desc.chroma_h);
+ zfmt->subsample_w = mp_log2(desc.chroma_w);
+ zfmt->subsample_h = mp_log2(desc.chroma_h);
zfmt->color_family = ZIMG_COLOR_YUV;
if (desc.num_planes == 1) {