音频demo:将PCM数据与alaw、mulaw、g711数据的相互转换

news2024/9/21 4:38:47

1、README

前言

g711

(截图来源:https://blog.csdn.net/u014470361/article/details/88837776)

我的理解:

首先需要知道的是u-law/a-law是用于脉冲编码的压缩/解压缩算法。而G.711是指在8KHz采样率(单声道)中,使用的u-law或a-law算法对音频进行压缩的一种语音压缩标准。但是,使用这两种压缩算法进行压缩的音频并不一定是G.711,要在8KHz采样率(单声道)的才是,压缩其他采样率和多声道得到的u-law/a-law文件只要设置对应的采样率和声道数照样能解压播放。

a. 编译

demo引用了开源代码g711.cg711.h,然后在此基础上封装成g711_wraper.cg711_wraper.h,并编写自己的测试程序main.c进行验证。整个demo程序共5个源文件,可以编译到任意环境下使用(非类Unix系统可能需要简单调整main.c中包含的头文件):

$ make   # 或者: make CC=your-crosscompile-gcc
b. 使用
examples: 
         ./pcm_alaw_ulaw -h
         ./pcm_alaw_ulaw --help
         ./pcm_alaw_ulaw -m pcm_2_alaw -i ./audio/test_8000_16_1.pcm -o ./test_8000_8_1.g711a
         ./pcm_alaw_ulaw -m pcm_2_ulaw -i ./audio/test_8000_16_1.pcm -o ./test_8000_8_1.g711u
         ./pcm_alaw_ulaw -m alaw_2_pcm -i ./audio/test_8000_8_1.g711a -o ./test_8000_16_1.pcm
         ./pcm_alaw_ulaw -m ulaw_2_pcm -i ./audio/test_8000_8_1.g711u -o ./test_8000_16_1.pcm
         ./pcm_alaw_ulaw -m alaw_2_ulaw -i ./audio/test_8000_8_1.g711a -o ./test_8000_8_1.g711u
         ./pcm_alaw_ulaw -m ulaw_2_alaw -i ./audio/test_8000_8_1.g711u -o ./test_8000_8_1.g711a
         ./pcm_alaw_ulaw --mode pcm_2_ulaw --input_file=./audio/test_8000_16_2.pcm --output_file=./test_8000_8_2.ulaw
         ./pcm_alaw_ulaw --mode pcm_2_ulaw --input_file=./audio/test_22050_16_1.pcm --output_file=./test_22050_8_1.ulaw
         ./pcm_alaw_ulaw --mode pcm_2_alaw --input_file=./audio/test_44100_16_2.pcm --output_file=./test_44100_8_2.alaw
         ...
         [mode: pcm_2_alaw | pcm_2_ulaw | alaw_2_pcm | ulaw_2_pcm | alaw_2_ulaw | ulaw_2_alaw]
c. demo目录架构
.
├── audio
│   ├── test_22050_16_1.pcm
│   ├── test_22050_8_1.ulaw
│   ├── test_44100_16_2.pcm
│   ├── test_44100_8_2.alaw
│   ├── test_8000_16_1.pcm
│   ├── test_8000_16_2.pcm
│   ├── test_8000_8_1.g711a
│   ├── test_8000_8_1.g711u
│   └── test_8000_8_2.ulaw
├── docs
│   ├── G711编码原理及代码_szfhy的博客-CSDN博客_g711编码.mhtml
│   └── 音频采样及编解码——LPCM 、ADPCM、G711、G726、AAC_夜风的博客-CSDN博客_adpcm.mhtml
├── main.c
├── Makefile
├── pcm_aulaw.c
├── pcm_aulaw.h
├── pcm_aulaw_wraper.c
├── pcm_aulaw_wraper.h
└── README.md

2、主要代码片段

pcm_aulaw.c
/*
 * This source code is a product of Sun Microsystems, Inc. and is provided
 * for unrestricted use.  Users may copy or modify this source code without
 * charge.
 *
 * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
 * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
 *
 * Sun source code is provided with no support and without any obligation on
 * the part of Sun Microsystems, Inc. to assist in its use, correction,
 * modification or enhancement.
 *
 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
 * OR ANY PART THEREOF.
 *
 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
 * or profits or other special, indirect and consequential damages, even if
 * Sun has been advised of the possibility of such damages.
 *
 * Sun Microsystems, Inc.
 * 2550 Garcia Avenue
 * Mountain View, California  94043
 */
/*
 * December 30, 1994:
 * Functions linear2alaw, linear2ulaw have been updated to correctly
 * convert unquantized 16 bit values.
 * Tables for direct u- to A-law and A- to u-law conversions have been
 * corrected.
 * Borge Lindberg, Center for PersonKommunikation, Aalborg University.
 * bli@cpk.auc.dk
 *
 */
/*
 * Downloaded from comp.speech site in Cambridge.
 *
 */

#include "pcm_aulaw.h"

/*
 * pcm_aulaw.c
 *
 * u-law, A-law and linear PCM conversions.
 * Source: http://www.speech.kth.se/cost250/refsys/latest/src/g711.c
 */
#define	SIGN_BIT	(0x80)		/* Sign bit for a A-law byte. */
#define	QUANT_MASK	(0xf)		/* Quantization field mask. */
#define	NSEGS		(8)		/* Number of A-law segments. */
#define	SEG_SHIFT	(4)		/* Left shift for segment number. */
#define	SEG_MASK	(0x70)		/* Segment field mask. */

static short seg_aend[8] = {0x1F, 0x3F, 0x7F, 0xFF,
			    0x1FF, 0x3FF, 0x7FF, 0xFFF};
static short seg_uend[8] = {0x3F, 0x7F, 0xFF, 0x1FF,
			    0x3FF, 0x7FF, 0xFFF, 0x1FFF};

/* copy from CCITT G.711 specifications */
unsigned char _u2a[128] = {			/* u- to A-law conversions */
	1,	1,	2,	2,	3,	3,	4,	4,
	5,	5,	6,	6,	7,	7,	8,	8,
	9,	10,	11,	12,	13,	14,	15,	16,
	17,	18,	19,	20,	21,	22,	23,	24,
	25,	27,	29,	31,	33,	34,	35,	36,
	37,	38,	39,	40,	41,	42,	43,	44,
	46,	48,	49,	50,	51,	52,	53,	54,
	55,	56,	57,	58,	59,	60,	61,	62,
	64,	65,	66,	67,	68,	69,	70,	71,
	72,	73,	74,	75,	76,	77,	78,	79,
/* corrected:
	81,	82,	83,	84,	85,	86,	87,	88, 
   should be: */
	80,	82,	83,	84,	85,	86,	87,	88,
	89,	90,	91,	92,	93,	94,	95,	96,
	97,	98,	99,	100,	101,	102,	103,	104,
	105,	106,	107,	108,	109,	110,	111,	112,
	113,	114,	115,	116,	117,	118,	119,	120,
	121,	122,	123,	124,	125,	126,	127,	128};

unsigned char _a2u[128] = {			/* A- to u-law conversions */
	1,	3,	5,	7,	9,	11,	13,	15,
	16,	17,	18,	19,	20,	21,	22,	23,
	24,	25,	26,	27,	28,	29,	30,	31,
	32,	32,	33,	33,	34,	34,	35,	35,
	36,	37,	38,	39,	40,	41,	42,	43,
	44,	45,	46,	47,	48,	48,	49,	49,
	50,	51,	52,	53,	54,	55,	56,	57,
	58,	59,	60,	61,	62,	63,	64,	64,
	65,	66,	67,	68,	69,	70,	71,	72,
/* corrected:
	73,	74,	75,	76,	77,	78,	79,	79,
   should be: */
	73,	74,	75,	76,	77,	78,	79,	80,
	80,	81,	82,	83,	84,	85,	86,	87,
	88,	89,	90,	91,	92,	93,	94,	95,
	96,	97,	98,	99,	100,	101,	102,	103,
	104,	105,	106,	107,	108,	109,	110,	111,
	112,	113,	114,	115,	116,	117,	118,	119,
	120,	121,	122,	123,	124,	125,	126,	127};

static short search(
   short val,
   short *table,
   short size)
{
   short i;
   
   for (i = 0; i < size; i++) {
      if (val <= *table++)
	 return (i);
   }
   return (size);
}

/*
 * linear2alaw() - Convert a 16-bit linear PCM value to 8-bit A-law
 *
 * linear2alaw() accepts an 16-bit integer and encodes it as A-law data.
 *
 *		Linear Input Code	Compressed Code
 *	------------------------	---------------
 *	0000000wxyza			000wxyz
 *	0000001wxyza			001wxyz
 *	000001wxyzab			010wxyz
 *	00001wxyzabc			011wxyz
 *	0001wxyzabcd			100wxyz
 *	001wxyzabcde			101wxyz
 *	01wxyzabcdef			110wxyz
 *	1wxyzabcdefg			111wxyz
 *
 * For further information see John C. Bellamy's Digital Telephony, 1982,
 * John Wiley & Sons, pps 98-111 and 472-476.
 */
unsigned char
linear2alaw(short pcm_val)	/* 2's complement (16-bit range) */
{
   short	 mask;
   short	 seg;
   unsigned char aval;
   
   pcm_val = pcm_val >> 3;

   if (pcm_val >= 0) {
      mask = 0xD5;		/* sign (7th) bit = 1 */
   } else {
      mask = 0x55;		/* sign bit = 0 */
      pcm_val = -pcm_val - 1;
   }
   
   /* Convert the scaled magnitude to segment number. */
   seg = search(pcm_val, seg_aend, 8);
   
   /* Combine the sign, segment, and quantization bits. */
   
   if (seg >= 8)		/* out of range, return maximum value. */
      return (unsigned char) (0x7F ^ mask);
   else {
      aval = (unsigned char) seg << SEG_SHIFT;
      if (seg < 2)
	 aval |= (pcm_val >> 1) & QUANT_MASK;
      else
	 aval |= (pcm_val >> seg) & QUANT_MASK;
      return (aval ^ mask);
   }
}

/*
 * alaw2linear() - Convert an A-law value to 16-bit linear PCM
 *
 */
short
alaw2linear(
   unsigned char	a_val)
{
   short t;
   short seg;
   
   a_val ^= 0x55;
   
   t = (a_val & QUANT_MASK) << 4;
   seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT;
   switch (seg) {
   case 0:
      t += 8;
      break;
   case 1:
      t += 0x108;
      break;
   default:
      t += 0x108;
      t <<= seg - 1;
   }
   return ((a_val & SIGN_BIT) ? t : -t);
}

#define	BIAS		(0x84)		/* Bias for linear code. */
#define CLIP            8159

/*
* linear2ulaw() - Convert a linear PCM value to u-law
*
* In order to simplify the encoding process, the original linear magnitude
* is biased by adding 33 which shifts the encoding range from (0 - 8158) to
* (33 - 8191). The result can be seen in the following encoding table:
*
*	Biased Linear Input Code	Compressed Code
*	------------------------	---------------
*	00000001wxyza			000wxyz
*	0000001wxyzab			001wxyz
*	000001wxyzabc			010wxyz
*	00001wxyzabcd			011wxyz
*	0001wxyzabcde			100wxyz
*	001wxyzabcdef			101wxyz
*	01wxyzabcdefg			110wxyz
*	1wxyzabcdefgh			111wxyz
*
* Each biased linear code has a leading 1 which identifies the segment
* number. The value of the segment number is equal to 7 minus the number
* of leading 0's. The quantization interval is directly available as the
* four bits wxyz.  * The trailing bits (a - h) are ignored.
*
* Ordinarily the complement of the resulting code word is used for
* transmission, and so the code word is complemented before it is returned.
*
* For further information see John C. Bellamy's Digital Telephony, 1982,
* John Wiley & Sons, pps 98-111 and 472-476.
*/
unsigned char
linear2ulaw(
   short pcm_val)	/* 2's complement (16-bit range) */
{
   short         mask;
   short	 seg;
   unsigned char uval;
   
   /* Get the sign and the magnitude of the value. */
   pcm_val = pcm_val >> 2;
   if (pcm_val < 0) {
      pcm_val = -pcm_val;
      mask = 0x7F;
   } else {
      mask = 0xFF;
   }
   if ( pcm_val > CLIP ) pcm_val = CLIP;		/* clip the magnitude */
   pcm_val += (BIAS >> 2);
   
   /* Convert the scaled magnitude to segment number. */
   seg = search(pcm_val, seg_uend, 8);
   
   /*
   * Combine the sign, segment, quantization bits;
   * and complement the code word.
   */
   if (seg >= 8)		/* out of range, return maximum value. */
      return (unsigned char) (0x7F ^ mask);
   else {
      uval = (unsigned char) (seg << 4) | ((pcm_val >> (seg + 1)) & 0xF);
      return (uval ^ mask);
   }
   
}

/*
 * ulaw2linear() - Convert a u-law value to 16-bit linear PCM
 *
 * First, a biased linear code is derived from the code word. An unbiased
 * output can then be obtained by subtracting 33 from the biased code.
 *
 * Note that this function expects to be passed the complement of the
 * original code word. This is in keeping with ISDN conventions.
 */
short
ulaw2linear(
   unsigned char	u_val)
{
   short t;
   
   /* Complement to obtain normal u-law value. */
   u_val = ~u_val;
   
   /*
    * Extract and bias the quantization bits. Then
    * shift up by the segment number and subtract out the bias.
    */
   t = ((u_val & QUANT_MASK) << 3) + BIAS;
   t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT;
   
   return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS));
}

/* A-law to u-law conversion */
unsigned char
alaw2ulaw(
   unsigned char	aval)
{
   aval &= 0xff;
   return (unsigned char) ((aval & 0x80) ? (0xFF ^ _a2u[aval ^ 0xD5]) :
	   (0x7F ^ _a2u[aval ^ 0x55]));
}

/* u-law to A-law conversion */
unsigned char
ulaw2alaw(
   unsigned char	uval)
{
   uval &= 0xff;
   return (unsigned char) ((uval & 0x80) ? (0xD5 ^ (_u2a[0xFF ^ uval] - 1)) :
			   (0x55 ^ (_u2a[0x7F ^ uval] - 1)));
}

/* ---------- end of pcm_aulaw.c ----------------------------------------------------- */
pcm_aulaw_wraper.c
#include "pcm_aulaw.h"
#include "pcm_aulaw_wraper.h"


void pcm_2_alaw(const short *src_16lepcm, unsigned char *dst_alaw, unsigned int sample_cnt)
{
	for (int i = 0; i < sample_cnt; i++)
	{
		dst_alaw[i] = linear2alaw(src_16lepcm[i]);
	}
}


void alaw_2_pcm(const unsigned char *src_alaw, short *dst_16lepcm, unsigned int sample_cnt)
{
	for (int i = 0; i < sample_cnt; i++)
	{
		dst_16lepcm[i] = alaw2linear(src_alaw[i]);
	}
}


void pcm_2_ulaw(const short *src_16lepcm, unsigned char *dst_ulaw, unsigned int sample_cnt)
{
	for (int i = 0; i < sample_cnt; i++)
	{
		dst_ulaw[i] = linear2ulaw(src_16lepcm[i]);
	}
}


void ulaw_2_pcm(const unsigned char *src_ulaw, short *dst_16lepcm, unsigned int sample_cnt)
{
	for (int i = 0; i < sample_cnt; i++)
	{
		dst_16lepcm[i] = ulaw2linear(src_ulaw[i]);
	}
}



void alaw_2_ulaw(const unsigned char *src_alaw, char *dst_ulaw, unsigned int sample_cnt)
{
	for (int i = 0; i < sample_cnt; i++)
	{
		dst_ulaw[i] = alaw2ulaw(src_alaw[i]);
	}
}


void ulaw_2_alaw(const unsigned char *src_ulaw, char *dst_alaw, unsigned int sample_cnt)
{
	for (int i = 0; i < sample_cnt; i++)
	{
		dst_alaw[i] = ulaw2alaw(src_ulaw[i]);
	}
}

main.c
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <unistd.h>

#include "pcm_aulaw_wraper.h"


void print_usage(const char *process)
{
	printf("examples: \n"
		   "\t %s -h\n"
		   "\t %s --help\n"
		   "\t %s -m pcm_2_alaw -i ./audio/test_8000_16_1.pcm -o ./test_8000_8_1.g711a\n"
		   "\t %s -m pcm_2_ulaw -i ./audio/test_8000_16_1.pcm -o ./test_8000_8_1.g711u\n"
		   "\t %s -m alaw_2_pcm -i ./audio/test_8000_8_1.g711a -o ./test_8000_16_1.pcm\n"
		   "\t %s -m ulaw_2_pcm -i ./audio/test_8000_8_1.g711u -o ./test_8000_16_1.pcm\n"
		   "\t %s -m alaw_2_ulaw -i ./audio/test_8000_8_1.g711a -o ./test_8000_8_1.g711u\n"
		   "\t %s -m ulaw_2_alaw -i ./audio/test_8000_8_1.g711u -o ./test_8000_8_1.g711a\n"
		   "\t %s --mode pcm_2_ulaw --input_file=./audio/test_8000_16_2.pcm --output_file=./test_8000_8_2.ulaw\n"
		   "\t %s --mode pcm_2_ulaw --input_file=./audio/test_22050_16_1.pcm --output_file=./test_22050_8_1.ulaw\n"
		   "\t %s --mode pcm_2_alaw --input_file=./audio/test_44100_16_2.pcm --output_file=./test_44100_8_2.alaw\n"
		   "\t ...\n"
		   "\t [mode: pcm_2_alaw | pcm_2_ulaw | alaw_2_pcm | ulaw_2_pcm | alaw_2_ulaw | ulaw_2_alaw]\n\n",
		   process, process, process, process, process, process, process, process, process, process, process);
}


#define 	BUF_LEN 	(160)


int main(int argc, char **argv)
{
	/* 输入/输出文件 */
	FILE *fpInput = NULL;
	FILE *fpOutput = NULL;
	char inputFileName[128] = {0};
	char outputFileName[128] = {0};	
	char inputBuf[BUF_LEN*2] = {0};
	char outputBuf[BUF_LEN*2] = {0};
	
	/* 输入文件与输出文件的转换模式 */	
	char convert_mode[128] = {0};	

	if (argc == 1)
	{
		print_usage(argv[0]);
		return 0;
	}


	/* 解析命令行参数 */
	char option = 0;
	int option_index = 0;
	char *short_options = "hm:i:o:";
	struct option long_options[] =
	{
		{"help",        no_argument,       NULL, 'h'},
		{"mode",        required_argument, NULL, 'm'},
		{"input_file",  required_argument, NULL, 'i'},
		{"output_file", required_argument, NULL, 'o'},
		{NULL,          0,                 NULL,  0 },
	};
	while((option = getopt_long_only(argc, argv, short_options, long_options, &option_index)) != -1)
	{
		switch(option)
		{
			case 'h':
				print_usage(argv[0]);
				return 0;
			case 'm':
				strncpy(convert_mode, optarg, 128);
				break;
			case 'i':
				strncpy(inputFileName, optarg, 128);
				break;
			case 'o':
				strncpy(outputFileName, optarg, 128);
				break;
			defalut:
				printf("Unknown argument!\n");
				break;
		}
	}

	fpInput = fopen(inputFileName, "rb");
	if (fpInput == NULL)
	{
		perror("Open input file error");
		return -1;
	}
	fpOutput = fopen(outputFileName, "wb");
	if (fpOutput == NULL)
	{
		perror("Open output file error");
		return -1;
	}



	while(1)
	{
		/* read data */
		int readBytes = fread(inputBuf, 1, BUF_LEN, fpInput);
		if (readBytes <= 0)
		{
			break;
		}

		/* convert and write data */
		if(0 == strcmp(convert_mode, "pcm_2_alaw"))
		{
			pcm_2_alaw((const short *)inputBuf, outputBuf, readBytes/2);
			fwrite(outputBuf, 1, readBytes/2, fpOutput);
		}
		else if(0 == strcmp(convert_mode, "pcm_2_ulaw"))
		{
			pcm_2_ulaw((const short *)inputBuf, outputBuf, readBytes/2);
			fwrite(outputBuf, 1, readBytes/2, fpOutput);
		}
		else if(0 == strcmp(convert_mode, "alaw_2_pcm"))
		{
			alaw_2_pcm(inputBuf, (short *)outputBuf, readBytes);
			fwrite(outputBuf, 1, readBytes*2, fpOutput);
		}
		else if(0 == strcmp(convert_mode, "ulaw_2_pcm"))
		{
			ulaw_2_pcm(inputBuf, (short *)outputBuf, readBytes);
			fwrite(outputBuf, 1, readBytes*2, fpOutput);
		}
		else if(0 == strcmp(convert_mode, "alaw_2_ulaw"))
		{
			alaw_2_ulaw(inputBuf, outputBuf, readBytes);
			fwrite(outputBuf, 1, readBytes, fpOutput);
		}
		else if(0 == strcmp(convert_mode, "ulaw_2_alaw"))
		{
			ulaw_2_alaw(inputBuf, outputBuf, readBytes);
			fwrite(outputBuf, 1, readBytes, fpOutput);
		}
		else
		{
			printf("The convert mode is not supported!\n");
			goto error_exit;
		}
	}

	printf("\033[32m %s ==> %s Success!\033[0m\n", inputFileName, outputFileName);

error_exit:
	fclose(fpInput);
	fclose(fpOutput);

	return 0;
}

3、demo下载地址(任选一个)

  • https://download.csdn.net/download/weixin_44498318/89525479

  • https://gitee.com/linriming/audio_pcm_alaw_ulaw_g711_convert.git

  • https://github.com/linriming20/audio_pcm_alaw_ulaw_g711_convert.git

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1908401.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

uni-app 封装http请求

1.引言 前面一篇文章写了使用Pinia进行全局状态管理。 这篇文章主要介绍一下封装http请求&#xff0c;发送数据请求到服务端进行数据的获取。 感谢&#xff1a; 1.yudao-mall-uniapp: 芋道商城&#xff0c;基于 Vue Uniapp 实现&#xff0c;支持分销、拼团、砍价、秒杀、优…

搞不清啊?伦敦金与上海金区别是?

进入黄金市场的朋友&#xff0c;有可能会被各式各样的黄金交易品种带得眼花缭乱&#xff0c;其实各品种虽然都以黄金作为投资标的物&#xff0c;但是也是各有不同的&#xff0c;下面我们就来比较一下相似的投资品种——伦敦金和上海金。 首先在比较之前&#xff0c;我们要搞清楚…

计算机毕业设计Django+Vue.js考研推荐系统 考研分数线预测 中公考研爬虫 混合神经网络推荐算法 考研可视化 机器学习 深度学习 大数据毕业设计

Python数据分析与可视化期末项目报告 项目名称&#xff1a; 考研推荐系统数据分析与可视化 学 号&#xff1a; 姓 名&#xff1a; …

Spire.PDF for .NET【文档操作】演示:以特在 C# 中创建 PDF/A-1a 文件

PDF/A-1 标准为 PDF 文件指定了两个符合性级别&#xff1a;PDF/A-1a&#xff08;符合 A 级&#xff09;和 PDF/A-1b&#xff08;符合 B 级&#xff09;。使用 Spire.PDF&#xff0c;您可以轻松创建 PDF/A-1a 和 PDF/A-1b 文件。本文演示了如何使用 Spire.PDF 创建 PDF/A-1a 文件…

MySQL第三次练习

作业三 一 先创建DB abc&#xff0c;创建table student 1、插入一条记录 2、添加多条记录 3、添加部分记录 4、加0.5 5、删除成绩为空的记录 二 1、创建一个用户test1使他只能本地登录拥有查询student表的权限。 2、查询用户test1的权限。 3、删除用户test1. 全在一张图上…

刀客网源码账号合租平台

最新租号平台系统源码&#xff0c;支持单独租用或合租使用 这是一款租号平台源码&#xff0c;采用常见的租号模式。 平台的主要功能如下&#xff1a; 支持单独租用或采用合租模式&#xff0c;采用易支付通用接口进行支付&#xff0c;添加邀请返利功能&#xff0c;以便站长更好…

ubuntu22.04搭建mysql5.7

1.1 下载mysql安装包 MySQL下载地址&#xff1a;MySQL :: Download MySQL Community Server (Archived Versions) #下载wget https://cdn.mysql.com/archives/mysql-5.7/mysql-server_5.7.29-1ubuntu18.04_amd64.deb-bundle.tar#解压tar -xvf ./mysql-server_5.7.29-1ubuntu18…

排序学习笔记

1.什么是排序 1.1排序的概念 概念&#xff1a;排序的概念其实非常简单&#xff0c;本质上就是将一堆记录按照从大到小(降序)&#xff0c;从小到大(升序)来进行排序。我们日常生活中每天都有着不同的排序&#xff0c;比如年龄大小排序&#xff0c;身高的排序等等。 稳定性&am…

如何把已经上传到gitlab的代码或者文件夹从git上删掉

有小伙伴不小心把缓存文件上传到了git&#xff0c;跑来问我&#xff0c;要怎么把这些文件给删掉&#xff0c;这里一共有两种方式&#xff0c; 先说第一种&#xff0c;通过命令删除&#xff0c;终端进入存在这个缓存文件的目录&#xff0c;执行命令ls&#xff0c;可以看到确实有…

STM32学习历程(day5)

EXTI外部中断 中断 中断就是在主程序运行过程中 出现了特定的中断触发条件&#xff08;中断源&#xff09;&#xff0c;CPU会暂停当前的程序&#xff0c;去处理中断程序 处理完会返回被暂停的位置 继续运行原来的程序。 中断优先级 当有多个中断源同时申请中断时 CPU会根据…

如何安全隐藏IP地址,防止网络攻击?

当您想在互联网上保持隐私或匿名时&#xff0c;您应该做的第一件事就是隐藏您的 IP 地址。您的 IP 地址很容易被追踪到您&#xff0c;并被用来了解您的位置。下面的文章将教您如何隐藏自己&#xff0c;不让任何试图跟踪您的活动的人发现。 什么是 IP 地址&#xff1f; 首先&am…

初中生物知识点总结(人教版)

第一章 认识生物 一、 生物的特征&#xff1a; 1&#xff0e; 生物的生活需要营养 2&#xff0e; 生物能进行呼吸 3&#xff0e; 生物能排出身体内产生的废物 4&#xff0e; 生物能对外界的刺激做出反应 5&#xff0e; 生物能生长和繁殖 除病毒以外&#xff0c;生物都是由细胞构…

python中getattr/setattr/hasattr/delattr函数都是干什么的?

目录 1、getattr&#xff1a;动态获取属性 &#x1f50d; 1.1 动态获取属性 1.2 默认值处理技巧 1.3 实战案例&#xff1a;配置文件动态加载 2、setattr&#xff1a;动态设置属性 &#x1f6e0; 2.1 修改对象属性 2.2 新增属性场景 2.3 应用场景&#xff1a;类的动态配置…

零基础也能成为产品册设计高手

​在当今数字化时代&#xff0c;产品册设计已成为企业营销的重要手段之一。过去&#xff0c;人们认为只有专业人士才能设计出精美的产品册&#xff0c;然而&#xff0c;随着设计工具的普及和在线学习资源的丰富&#xff0c;零基础的你也能成为产品册设计高手。本文将带你走进这…

一文清晰了解HTML

有这样一个txt记事本文件和一张图片&#xff1a; txt文本内容是这样的&#xff1a; <html><head><title>HTML学习</title></head><body><h1>hello HTML</h1><img src"高清修复.png"/></body> </html…

泫雅甜蜜官宣爱情开花

【标题】泫雅甜蜜官宣&#xff1a;爱情花开&#xff0c;携手龙俊亨共赴婚姻殿堂&#xff0c;邀您共鉴幸福时刻&#xff01;在这个金秋送爽、爱意弥漫的季节里&#xff0c;韩国娱乐圈迎来了一则振奋的消息——我们的“小野马”泫雅&#xff0c;正式宣布了她人生中的重大决定&…

MyBatis是如何分页的及原理

MyBatis 是一种持久层框架&#xff0c;支持通过配置文件和注解将 SQL 映射为 Java 对象。在实际开发中&#xff0c;查询数据时经常需要进行分页处理。 MyBatis 也提供了支持分页的方案&#xff0c;其主要思路是使用 Limit 偏移量和限制个数&#xff0c;来获取指定数量的数据。下…

全网视频下载之IDM下载安装,软破解

全网视频下载之IDM下载安装&#xff0c;软破解 介绍![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/c94f612f7a8845c8a649f74f6b18fd70.png)下载安装配置浏览器Google浏览器Ddge浏览器 界面如何下载不破解如何重复使用总结 介绍 今天给大家分享一个更加简便的全网视…

【Python】已解决:FileNotFoundError: [Errno 2] No such file or directory: ‘D:\1. PDF’

文章目录 一、分析问题背景二、可能出错的原因三、错误代码示例四、正确代码示例五、注意事项 已解决&#xff1a;FileNotFoundError: [Errno 2] No such file or directory: ‘D:\1. PDF’ 一、分析问题背景 在Python编程中&#xff0c;当你尝试打开一个不存在的文件时&…

放大镜案例

放大镜 <!DOCTYPE html> <html lang"zh-cn"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>商品放大镜</title><link rel&qu…