当前位置: 首页 > news >正文

FFmpeg音频重采样基本流程

目录

    • 流程概述
    • 用到的API
    • tips
    • demo样例
    • 附录 - SwrContext结构体字段

流程概述

音频重采样的基本流程为:

  1. 申请重采样器上下文
  2. 设置重采样去上下文的参数
  3. 初始化重采样器
  4. 申请数据存放的缓冲区空间
  5. 进行重采样

注意,要先设置参数再对重采样器初始化

用到的API

  1. SwrContext重采样器上下文的结构体。此结构是不透明的,这意味着,如果要设置选项,诸如av_opt_set等函数来设置。

  2. struct SwrContext *swr_alloc();,申请重采样器上下文。

  3. int av_opt_set(void *obj, const char *name, const char *val, int search_flags);
    int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags);
    int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *layout, int search_flags);
    av_opt_set* 函数簇,这里仅列举几个。以av_opt_set为例,用于将给定name的obj字段设置为指定的val。第一个void* 的obj参数表示要设置的对象,第二个name参数表示要设置的字段名称,以字符串形式传入。例如obj为SwrContext* 对象,name为"in_sample_rate"就对应着SwrContext中的同名字段。中间的部分就为要设置的参数,最后的search_flags表示搜索搜索标志,一般设为0即可。

  4. int swr_alloc_set_opts2(struct SwrContext **ps, const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, const AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx);如果还未分配则分配SwrContext,并设置/重置公共参数。就相当于alloc + set。

  5. int swr_init(struct SwrContext *s);重采样去初始化。必须在设置过SwrContext 参数之后初始化。

  6. int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)int64_t av_rescale(int64_t a, int64_t b, int64_t c)都是用于计算的(a*b/c),唯一的区别在于rnd可以设置向上取整向下取整等。

  7. int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align);
    申请一个 data[nb_channels][ch_data] 的二维数组,所以audio_data要作为一个三级指针传进去。

  8. void av_freep(void *ptr);释放av_samples_alloc_array_and_samples申请的data。av_freep即使传入null也是安全的。用法示例:

    uint8_t *buf = av_malloc(16);
    av_freep(&buf);
    
  9. int64_t swr_get_delay(struct SwrContext *s, int64_t base);获取下一个输入样本相对于下一个输出样本所经历的延迟帧数。

  10. int swr_convert(struct SwrContext *s, uint8_t * const *out, int out_count, const uint8_t * const *in , int in_count);
    音频重采样,in和out是由av_samples_alloc_array_and_samples生成的data缓冲区。in_count和out_count则是对应的缓冲区大小的样本数。

  11. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align);
    获取给定音频参数所需的缓冲区大小。

tips

  1. swr是software resample的缩写
  2. nb_samples样本数,表示每帧的每个通道中的采样点数。
  3. 重采样的三个关键参数:采样率、采样格式、声道布局。
  4. 音频的planner格式的数据是分在多个数组中的,例如左右声道的data[0]中存放L声道的数据,data[1]中存放R声道的数据。而交错模式的数据则是按照LRLR…的顺序统一放到data[0]中的。
  5. av_freep要取地址的原因,是因为要将指针置空,仅此而已。
  6. 老版本的FFmpeg,例如在ffmpeg-4.2下,音频声道数只是一个单一的int型字段。而新版本的FFmpeg,以ffmpeg-7.0为例,则是将音频数据封装为一个AVChannelLayout结构体了。所以在设置 ‘layout’ 字段时,不能再用av_opt_set_int接口,而是要用av_opt_set_chlayout,name参数也要使用"in_chlayout"才行。


demo样例

重采样样例,参考:Examples - resample_audio.c

#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
using namespace std;extern "C"
{
#include <libavutil/opt.h>
#include <libavutil/channel_layout.h>
#include <libavutil/samplefmt.h>
#include <libswresample/swresample.h>
}/* format转字符串 */
string string_sample_fmt(enum AVSampleFormat sample_fmt)
{// 定义sample_fmt_entry结构体,同时定义了一个数组struct sample_fmt_entry{enum AVSampleFormat sample_fmt; const char *fmt_be, *fmt_le;} sample_fmt_entries[] = {{ AV_SAMPLE_FMT_U8,  "u8",    "u8"    },{ AV_SAMPLE_FMT_S16, "s16be", "s16le" },{ AV_SAMPLE_FMT_S32, "s32be", "s32le" },{ AV_SAMPLE_FMT_FLT, "f32be", "f32le" },{ AV_SAMPLE_FMT_DBL, "f64be", "f64le" },};// 返回字符串const char* str_fmt = nullptr;int arr_len = FF_ARRAY_ELEMS(sample_fmt_entries);for (int i = 0; i < arr_len; i++){auto entry = sample_fmt_entries[i];if (sample_fmt == entry.sample_fmt){return AV_NE(entry.fmt_be, entry.fmt_le);}}
}/*** Fill dst buffer with nb_samples, generated starting from t.* 交错模式,函数摘自:https://ffmpeg.org/doxygen/7.0/resample_audio_8c-example.html* sin曲线,t表示当前所在的相位,周期为一帧所持续的时间*/
void fill_samples(double *dst, int nb_samples, int nb_channels, int sample_rate, double *t)
{int i, j;double tincr = 1.0 / sample_rate, *dstp = dst;const double c = 2 * M_PI * 440.0;/* generate sin tone with 440Hz frequency and duplicated channels */for (i = 0; i < nb_samples; i++) {*dstp = sin(c * *t);for (j = 1; j < nb_channels; j++)dstp[j] = dstp[0];dstp += nb_channels;*t += tincr;}
}int main()
{/* 采样参数定义 */// 输入参数int src_sample_rate = 48000;enum AVSampleFormat src_sample_fmt = AV_SAMPLE_FMT_DBL;AVChannelLayout src_ch_layout = AV_CHANNEL_LAYOUT_STEREO; // 立体声// 输出参数int dst_sample_rate = 44100;enum AVSampleFormat dst_sample_fmt = AV_SAMPLE_FMT_S16;AVChannelLayout dst_ch_layout = AV_CHANNEL_LAYOUT_STEREO; // 立体声// 创建重采样器上下文(暂且认为不会失败)SwrContext *swr_ctx = swr_alloc();/* 参数设置(SwrContext字段设置) */// 输入参数check_optset(av_opt_set_int(swr_ctx, "in_sample_rate", src_sample_rate, 0), __LINE__);check_optset(av_opt_set_sample_fmt(swr_ctx, "in_sample_fmt", src_sample_fmt, 0), __LINE__);check_optset(av_opt_set_chlayout(swr_ctx, "in_chlayout", &src_ch_layout, 0), __LINE__);// 输出参数check_optset(av_opt_set_int(swr_ctx, "out_sample_rate", dst_sample_rate, 0), __LINE__);check_optset(av_opt_set_sample_fmt(swr_ctx, "out_sample_fmt", dst_sample_fmt, 0), __LINE__);check_optset(av_opt_set_chlayout(swr_ctx, "out_chlayout", &dst_ch_layout, 0), __LINE__);// 参数设置完成后,初始化上下文swr_init(swr_ctx);// 给输入源分配内存空间uint8_t **src_data = nullptr;int src_linesize;int src_nb_samples = 1024; // 每个通道的样本数av_samples_alloc_array_and_samples(&src_data, &src_linesize, src_ch_layout.nb_channels,src_nb_samples, src_sample_fmt, 0);// 给输出源分配内存空间uint8_t **dst_data;int dst_linesize;// 计算输出的信道样本数:a * b / c,AV_ROUND_UP表示向上取整int dst_nb_samples = av_rescale_rnd(src_nb_samples, dst_sample_rate, src_sample_rate, AV_ROUND_UP);// 分配空间av_samples_alloc_array_and_samples(&dst_data, &dst_linesize, dst_ch_layout.nb_channels,dst_nb_samples, dst_sample_fmt, 0);// 采样转换double t = 0; // 时间,以输入源的时间为基准int max_nb_samples = dst_nb_samples;string dst_file_name = "out.pcm";ofstream dst_file(dst_file_name, ios_base::out | ios_base::binary);while(t < 10){// 生成输入源(模拟)fill_samples((double*)src_data[0], src_nb_samples, src_ch_layout.nb_channels, src_sample_rate, &t);// 获取延迟(dst音频相对src音频延迟的帧数)int64_t delay = swr_get_delay(swr_ctx, src_sample_rate);// 输出的信道样本数,a * b / cdst_nb_samples = av_rescale(delay + src_nb_samples, dst_sample_rate, src_sample_rate);// 如果输出缓冲区大小不够,重新申请空间if(dst_nb_samples > max_nb_samples){// 重新申请空间av_freep(&dst_data[0]);av_samples_alloc(dst_data, &dst_linesize, dst_ch_layout.nb_channels,dst_nb_samples, dst_sample_fmt, 1);max_nb_samples = dst_nb_samples;}// 音频重采样int ret = swr_convert(swr_ctx, dst_data, dst_nb_samples,(const uint8_t **)src_data, src_nb_samples);// 获取给定音频参数所需的缓冲区大小。int dst_buf_size = av_samples_get_buffer_size(&dst_linesize, dst_ch_layout.nb_channels,ret, dst_sample_fmt, 1);// writedst_file.write((char*)dst_data[0], dst_buf_size);}// clear and exit// TODO
}


附录 - SwrContext结构体字段

版本:ffmpeg-7.0

struct SwrContext {const AVClass *av_class;                        ///< AVClass used for AVOption and av_log()int log_level_offset;                           ///< logging level offsetvoid *log_ctx;                                  ///< parent logging contextenum AVSampleFormat  in_sample_fmt;             ///< input sample formatenum AVSampleFormat int_sample_fmt;             ///< internal sample format (AV_SAMPLE_FMT_FLTP or AV_SAMPLE_FMT_S16P)enum AVSampleFormat out_sample_fmt;             ///< output sample formatAVChannelLayout used_ch_layout;                 ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)AVChannelLayout  in_ch_layout;                  ///< input channel layoutAVChannelLayout out_ch_layout;                  ///< output channel layoutint      in_sample_rate;                        ///< input sample rateint     out_sample_rate;                        ///< output sample rateint flags;                                      ///< miscellaneous flags such as SWR_FLAG_RESAMPLEfloat slev;                                     ///< surround mixing levelfloat clev;                                     ///< center mixing levelfloat lfe_mix_level;                            ///< LFE mixing levelfloat rematrix_volume;                          ///< rematrixing volume coefficientfloat rematrix_maxval;                          ///< maximum value for rematrixing outputint matrix_encoding;                            /**< matrixed stereo encoding */const int *channel_map;                         ///< channel index (or -1 if muted channel) mapint engine;AVChannelLayout user_used_chlayout;             ///< User set used channel layoutAVChannelLayout user_in_chlayout;               ///< User set input channel layoutAVChannelLayout user_out_chlayout;              ///< User set output channel layoutenum AVSampleFormat user_int_sample_fmt;        ///< User set internal sample formatint user_dither_method;                         ///< User set dither methodstruct DitherContext dither;int filter_size;                                /**< length of each FIR filter in the resampling filterbank relative to the cutoff frequency */int phase_shift;                                /**< log2 of the number of entries in the resampling polyphase filterbank */int linear_interp;                              /**< if 1 then the resampling FIR filter will be linearly interpolated */int exact_rational;                             /**< if 1 then enable non power of 2 phase_count */double cutoff;                                  /**< resampling cutoff frequency (swr: 6dB point; soxr: 0dB point). 1.0 corresponds to half the output sample rate */int filter_type;                                /**< swr resampling filter type */double kaiser_beta;                                /**< swr beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER) */double precision;                               /**< soxr resampling precision (in bits) */int cheby;                                      /**< soxr: if 1 then passband rolloff will be none (Chebyshev) & irrational ratio approximation precision will be higher */float min_compensation;                         ///< swr minimum below which no compensation will happenfloat min_hard_compensation;                    ///< swr minimum below which no silence inject / sample drop will happenfloat soft_compensation_duration;               ///< swr duration over which soft compensation is appliedfloat max_soft_compensation;                    ///< swr maximum soft compensation in seconds over soft_compensation_durationfloat async;                                    ///< swr simple 1 parameter async, similar to ffmpegs -asyncint64_t firstpts_in_samples;                    ///< swr first pts in samplesint resample_first;                             ///< 1 if resampling must come first, 0 if rematrixingint rematrix;                                   ///< flag to indicate if rematrixing is needed (basically if input and output layouts mismatch)int rematrix_custom;                            ///< flag to indicate that a custom matrix has been definedAudioData in;                                   ///< input audio dataAudioData postin;                               ///< post-input audio data: used for rematrix/resampleAudioData midbuf;                               ///< intermediate audio data (postin/preout)AudioData preout;                               ///< pre-output audio data: used for rematrix/resampleAudioData out;                                  ///< converted output audio dataAudioData in_buffer;                            ///< cached audio data (convert and resample purpose)AudioData silence;                              ///< temporary with silenceAudioData drop_temp;                            ///< temporary used to discard outputint in_buffer_index;                            ///< cached buffer positionint in_buffer_count;                            ///< cached buffer lengthint resample_in_constraint;                     ///< 1 if the input end was reach before the output end, 0 otherwiseint flushed;                                    ///< 1 if data is to be flushed and no further input is expectedint64_t outpts;                                 ///< output PTSint64_t firstpts;                               ///< first PTSint drop_output;                                ///< number of output samples to dropdouble delayed_samples_fixup;                   ///< soxr 0.1.1: needed to fixup delayed_samples after flush has been called.struct AudioConvert *in_convert;                ///< input conversion contextstruct AudioConvert *out_convert;               ///< output conversion contextstruct AudioConvert *full_convert;              ///< full conversion context (single conversion for input and output)struct ResampleContext *resample;               ///< resampling contextstruct Resampler const *resampler;              ///< resampler virtual function tabledouble matrix[SWR_CH_MAX][SWR_CH_MAX];          ///< floating point rematrixing coefficientsfloat matrix_flt[SWR_CH_MAX][SWR_CH_MAX];       ///< single precision floating point rematrixing coefficientsuint8_t *native_matrix;uint8_t *native_one;uint8_t *native_simd_one;uint8_t *native_simd_matrix;int32_t matrix32[SWR_CH_MAX][SWR_CH_MAX];       ///< 17.15 fixed point rematrixing coefficientsuint8_t matrix_ch[SWR_CH_MAX][SWR_CH_MAX+1];    ///< Lists of input channels per output channel that have non zero rematrixing coefficientsmix_1_1_func_type *mix_1_1_f;mix_1_1_func_type *mix_1_1_simd;mix_2_1_func_type *mix_2_1_f;mix_2_1_func_type *mix_2_1_simd;mix_any_func_type *mix_any_f;/* TODO: callbacks for ASM optimizations */
};

相关文章:

FFmpeg音频重采样基本流程

目录 流程概述用到的APItipsdemo样例附录 - SwrContext结构体字段 流程概述 音频重采样的基本流程为&#xff1a; 申请重采样器上下文设置重采样去上下文的参数初始化重采样器申请数据存放的缓冲区空间进行重采样 注意&#xff0c;要先设置参数再对重采样器初始化 用到的API…...

无人机无人车固态锂电池技术详解

随着无人机和无人车技术的飞速发展&#xff0c;对高性能、高安全性电池的需求日益迫切。固态锂电池作为下一代电池技术的代表&#xff0c;正逐步从实验室走向市场&#xff0c;为无人机和无人车等应用领域带来革命性的变化。相比传统液态锂电池&#xff0c;固态锂电池在能量密度…...

ElementUI元件库在Axure中使用

一、ElementUI元件库介绍 ElementUI 是一套为开发者、UI/UX设计师和产品经理准备的基于Vue 2.0的桌面端组件库。它以其优雅的设计和丰富的组件&#xff0c;极大地提升了Web应用的开发效率与用户体验。ElementUI的组件设计精致且符合现代UI规范&#xff0c;包括按钮、表单、弹窗…...

联想M7615DNA打印机复印证件太黑的解决方法及个人建议

打印机在使用过程中&#xff0c;可能会出现复印的文字或图片太黑的问题&#xff0c;这会影响到打印或复印的效果。下面我们来了解一下这种情况的原因和解决方法&#xff1b;以下所述操作仅供大家参考&#xff0c;如有不足请大家提出宝贵意见&#xff1b; 证件包括&#xff1a;…...

【算法题】无重复字符的最长子串(滑动窗口)

目录 一、题目描述 二、解题思路 1、什么是滑动窗口算法&#xff1f; 2、滑动窗口一般解题模板 三、参考答案 一、题目描述 无重复字符的最长子串 给定一个字符串s &#xff0c;请你找出其中不含有重复字符的最长子串的长度。 示例 1: 输入: s "abcabcbb"…...

Hikari连接池 最大连接数与最小空闲连接数配置多少合适?

spring:datasource: # 数据源的相关配置type: com.zaxxer.hikari.HikariDataSource # 数据源类型&#xff1a;HikariCPdriver-class-name: com.mysql.jdbc.Driver # mysql驱动url: jdbc:mysql://localhost:3306/t…...

【2.4 python中的基本输入和输出】

2.4 python中的基本输入和输出 在Python中&#xff0c;基本输入和输出是通过内置的input()函数和print()函数来实现的。这两个函数提供了与用户或其他程序进行交互的基本方式。 1. input() 函数 input() 函数用于从标准输入设备&#xff08;通常是键盘&#xff09;接收一行文…...

netty长连接集群方案

背景 公司某拍卖系统使用的netty服务不支持集群部署,不能进行横向扩展;并且和用户聚合服务耦合在一起,服务多节点部署不能提高拍卖性能,不能支撑更多用户使用拍卖。 目前需要改造并出一个集群的方案。 思路 因为是长连接的服务做集群,需要我们在客户端和服务器建立链接…...

Python面试题:结合Python技术,如何使用Keras进行神经网络建模

使用Keras进行神经网络建模是机器学习和深度学习领域中常用的方法之一。Keras是一个高级神经网络API&#xff0c;能够在TensorFlow、Theano等后端上运行&#xff0c;提供了简单易用的接口。下面是使用Keras进行神经网络建模的基本步骤&#xff1a; 安装Keras Keras是集成在Te…...

dll文件丢失怎么恢复?超简单的5个方法,1分钟搞定dll文件修复!

DLL&#xff0c;或称动态链接库&#xff0c;是一种重要的文件类型&#xff0c;包含了一系列用于运行几乎所有程序的指令&#xff0c;这些程序在win11、win10、win8和win7系统中都广泛使用。如果Windows操作系统中的dll文件丢失&#xff0c;您可能无法正常启动所需的程序或应用。…...

[Meachines] [Easy] Sense PFSense防火墙RCE

信息收集 IP AddressOpening Ports10.10.10.60TCP:80,443 $ nmap -p- 10.10.10.60 --min-rate 1000 -sC -sV PORT STATE SERVICE VERSION 80/tcp open http lighttpd 1.4.35 |_http-title: Did not follow redirect to https://10.10.10.60/ |_http-server-header…...

codetop标签双指针题目大全解析(C++解法),双指针刷穿地心!!!

写在前面&#xff1a;此篇博客是以[双指针总结]博客为基础的针对性训练&#xff0c;题源是codetop标签双指针近一年&#xff0c;频率由高到低 1.无重复字符的最长子串2.三数之和3.环形链表4.合并两个有序数组5.接雨水6.环形链表II7.删除链表的倒数第N个节点8.训练计划II9.最小覆…...

Floyd求最短路

给定一个 nn 个点 mm 条边的有向图&#xff0c;图中可能存在重边和自环&#xff0c;边权可能为负数。 再给定 kk 个询问&#xff0c;每个询问包含两个整数 xx 和 yy&#xff0c;表示查询从点 xx 到点 yy 的最短距离&#xff0c;如果路径不存在&#xff0c;则输出 impossible。…...

python爬虫初识

一、什么互联网 互联网&#xff08;Internet&#xff09;是全球范围内最大的计算机网络&#xff0c;它将数以百万计的私人、公共、学术、商业和政府网络通过一系列标准通信协议&#xff08;如TCP/IP&#xff09;连接起来形成的一个庞大的国际网络。 互联网的起源可以追溯到196…...

Java中类的构造

1.私有化成员变量。 2.空参构造方法。 3.带全部参数的构造方法。 4.get / set方法。 package demo;public class student{//1.私有化成员变量。//2.空参构造方法。//3.带全部参数的构造方法。//4.get / set方法。private String name;private int age;public student() {}pu…...

【C++高阶】深入理解C++异常处理机制:从try到catch的全面解析

&#x1f4dd;个人主页&#x1f339;&#xff1a;Eternity._ ⏩收录专栏⏪&#xff1a;C “ 登神长阶 ” &#x1f921;往期回顾&#x1f921;&#xff1a;Lambda表达式 &#x1f339;&#x1f339;期待您的关注 &#x1f339;&#x1f339; ❀C异常 &#x1f4d2;1. C异常概念…...

【RHEL7】无人值守安装系统

目录 一、kickstart服务 1.下载kickstart 2.启动图形制作工具 3.选择设置 4.查看生成的文件 5.修改ks.cfg文件 二、HTTP服务 1.下载HTTP服务 2.启动HTTP服务 3.将挂载文件和ks.cfg放在HTTP默认目录下 4.测试HTTP服务 三、PXE 1.查看pxe需要安装什么 2.安装 四、…...

[RTOS 学习记录] 预备知识:C语言结构体

这篇文章是我阅读《嵌入式实时操作系统μCOS-II原理及应用》后的读书笔记&#xff0c;记录目的是为了个人后续回顾复习使用。 文章目录 结构体结构体基础声明和定义结构体类型声明和定义结构体变量初始化结构体变量初始化各个成员使用列表符号初始化 使用结构体变量综上 结构体…...

sqli-labs注入漏洞解析--less-9/10

第九关&#xff1a; 这一关相比第八关&#xff0c;第八关他正确显示you are in,错误不显示you are in,但是第九关你不管是输入正确或者错误都显示 you are in &#xff0c;这个时候布尔盲注就不适合我们用&#xff0c;所以我们的换一下思路,布尔盲注适合页面对于错误和正确结果…...

文心智能体平台:食尚小助,提供美食推荐和烹饪指导

文章目录 前言文心智能体平台介绍创建自己的智能体我的文心智能体体验地址总结 前言 在快节奏的现代生活中&#xff0c;许多人都希望能够享受美味的食物&#xff0c;但往往缺乏时间和精力来自己动手烹饪。为了解决这一问题&#xff0c;文心智能体平台推出了“食尚小助”智能体…...

工作中,如何有效解决“冲突”?不回避,不退让才是最佳方式

职场里每个人都在争取自己的利益&#xff0c;由于立场的不同&#xff0c;“冲突”不可避免。区别在于有些隐藏在暗处&#xff0c;有些摆在了台面上。 隐藏在“暗处”的冲突&#xff0c;表面上一团和气&#xff0c;实则在暗自较劲&#xff0c;甚至会有下三滥的手段&#xff1b;…...

Qt读写配置(ini)文件

本文介绍Qt读写配置&#xff08;ini&#xff09;文件。 1.配置文件&#xff08;ini&#xff09;简介 配置文件&#xff08;ini&#xff09;也叫ini文件&#xff08;Initialization File&#xff09;&#xff0c;即初始化文件。它由节名&#xff0c;键名&#xff0c;键值构成。…...

Python笔试面试题AI答之面向对象(2)

文章目录 6.阐述 Python自省&#xff08;机制与函数&#xff09; &#xff1f;7.简述Python中面向切面编程AOP和装饰器&#xff1f;面向切面编程&#xff08;AOP&#xff09;基本概念核心原理应用场景Python中的实现方式 装饰器&#xff08;Decorator&#xff09;基本概念语法应…...

Python学习计划——12.1选择一个小项目并完成

在这节课中&#xff0c;我们将选择一个小项目并完成它。为了综合运用前面所学的知识&#xff0c;我们选择构建一个简单的Web应用&#xff0c;该应用将包含数据分析和展示功能。我们将使用Flask框架和Pandas库来处理数据&#xff0c;并将结果展示在Web页面上。 项目&#xff1a…...

uniapp 多渠道打包实现方案

首先一个基础分包方案&#xff1a; 包不用区分渠道&#xff0c;只是通过文件名进行区分&#xff0c;公共代码逻辑可以通过mixins进行混入。 这样分包后就需要在打包时只针对编译的渠道包文件进行替换打包&#xff0c;其他渠道包的文件不打包进去&#xff0c;通过工具类实现…...

请你学习:前端布局3 - 浮动 float

1 标准流&#xff08;也称为普通流、文档流&#xff09; 标准流&#xff08;也称为普通流、文档流&#xff09;是CSS中元素布局的基础方式&#xff0c;它决定了元素在页面上的默认排列方式。这种布局方式遵循HTML文档的结构&#xff0c;不需要额外的CSS样式来指定元素的位置。…...

PyCharm 2024.1 总结和最新变化

​ 您好&#xff0c;我是程序员小羊&#xff01; 前言 PyCharm 2024.1 是 JetBrains 最新发布的Python集成开发环境&#xff08;IDE&#xff09;&#xff0c;旨在提供更强大的功能和更好的用户体验。以下是对这个版本的总结和最新变化的介绍 智能代码建议和自动完成&#xff1a…...

RGB红绿灯——Arduino

光的三原色 牛顿发现光的色散奥秘之后&#xff0c;进一步计算发现&#xff1a;七种色光中只有红、绿、蓝三种色光无法被分解&#xff0c;而其他四种颜色的光均可由这三种色光以不同比例相合而成。于是红、绿、蓝被称为“三原色光”或“光的三原色”。后经证实&#xff1a;红、绿…...

浅谈用二分和三分法解决问题(c++)

目录 问题引入[NOIP2001 提高组] 一元三次方程求解题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1 提示思路分析AC代码 思考关于二分和三分例题讲解进击的奶牛题目描述输入格式输出格式样例 #1样例输入 #1样例输出 #1 思路AC代码 平均数题目描述输入格式输出格式样例 …...

Cocos Creator2D游戏开发(9)-飞机大战(7)-爆炸效果

这个爆炸效果我卡在这里好长时间,视频反复的看, 然后把代码反复的测试,修改,终于给弄出来 视频中这段,作者也是修改了好几次, 跟着做也走了不少弯路; 最后反正弄出来了; 有几个坑; ① 动画体创建位置是enemy_prefab ② enemy_prefab预制体下不用放动画就行; ③ 代码中引用Anima…...