mirror of
https://github.com/mpv-player/mpv
synced 2025-04-18 05:07:18 +00:00
Use mp_log2() instead of av_log2()
This commit is contained in:
parent
7510ed6f68
commit
c10ba5eb8e
@ -22,8 +22,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <libavutil/common.h>
|
|
||||||
|
|
||||||
#include "mpv_talloc.h"
|
#include "mpv_talloc.h"
|
||||||
|
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
@ -272,7 +270,7 @@ int bstr_parse_utf8_code_length(unsigned char b)
|
|||||||
{
|
{
|
||||||
if (b < 128)
|
if (b < 128)
|
||||||
return 1;
|
return 1;
|
||||||
int bytes = 7 - av_log2(b ^ 255);
|
int bytes = 7 - mp_log2(b ^ 255);
|
||||||
return (bytes >= 2 && bytes <= 4) ? bytes : -1;
|
return (bytes >= 2 && bytes <= 4) ? bytes : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include <libavutil/common.h>
|
|
||||||
|
|
||||||
#include "mpv_talloc.h"
|
#include "mpv_talloc.h"
|
||||||
#include "bitmap_packer.h"
|
#include "bitmap_packer.h"
|
||||||
#include "common/common.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
|
#define HEIGHT_SORT_BITS 4
|
||||||
static int size_index(int s)
|
static int size_index(int s)
|
||||||
{
|
{
|
||||||
int n = av_log2_16bit(s);
|
int n = mp_log2(s);
|
||||||
return (n << HEIGHT_SORT_BITS)
|
return (n << HEIGHT_SORT_BITS)
|
||||||
+ ((- 1 - (s << HEIGHT_SORT_BITS >> n)) & ((1 << HEIGHT_SORT_BITS) - 1));
|
+ ((- 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);
|
ymax = MPMAX(ymax, in[i].y);
|
||||||
}
|
}
|
||||||
if (xmax > packer->w)
|
if (xmax > packer->w)
|
||||||
packer->w = 1 << (av_log2(xmax - 1) + 1);
|
packer->w = 1 << (mp_log2(xmax - 1) + 1);
|
||||||
if (ymax > packer->h)
|
if (ymax > packer->h)
|
||||||
packer->h = 1 << (av_log2(ymax - 1) + 1);
|
packer->h = 1 << (mp_log2(ymax - 1) + 1);
|
||||||
while (1) {
|
while (1) {
|
||||||
int used_width = 0;
|
int used_width = 0;
|
||||||
int y = pack_rectangles(in, packer->result, packer->count,
|
int y = pack_rectangles(in, packer->result, packer->count,
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
* 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/common.h"
|
||||||
#include "common/msg.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->width = fmt.w;
|
||||||
zfmt->height = fmt.h;
|
zfmt->height = fmt.h;
|
||||||
|
|
||||||
zfmt->subsample_w = av_log2(desc.chroma_w);
|
zfmt->subsample_w = mp_log2(desc.chroma_w);
|
||||||
zfmt->subsample_h = av_log2(desc.chroma_h);
|
zfmt->subsample_h = mp_log2(desc.chroma_h);
|
||||||
|
|
||||||
zfmt->color_family = ZIMG_COLOR_YUV;
|
zfmt->color_family = ZIMG_COLOR_YUV;
|
||||||
if (desc.num_planes == 1) {
|
if (desc.num_planes == 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user