file-type

2016共和党辩论推文情绪分析数据集

ZIP文件

1.08MB | 更新于2025-09-04 | 164 浏览量 | 0 下载量 举报 收藏
download 立即下载
从给出的文件信息中,可以提取出以下几个重要的知识点: 1. 数据集名称与主题:“First GOP Debate Twitter Sentiment”是一个关于2016年首个共和党总统辩论推文情绪分析的数据集。这意味着该数据集专注于收集在2016年首个共和党辩论期间在Twitter上发布的推文,并对这些推文所表达的情绪进行了分析。 2. 情绪分析:“Sentiment Analysis”是一种自然语言处理技术,用于识别和提取文本数据中的主观信息。在这个数据集中,可能是通过情绪分析工具或算法来判断推文中的情绪倾向,通常将情绪分类为正面、负面或中性。这项技术广泛应用于社交媒体分析、市场研究、产品反馈和客户满意度调查等领域。 3. 数据集文件结构:从文件名称“First GOP Debate Twitter Sentiment_datasets.txt”和“Sentiment.csv”可以推断,这个数据集可能包含两个主要文件。一个是文本文件(.txt),可能是用于描述数据集本身信息、数据来源或数据格式说明;另一个是CSV文件(.csv),通常用于存储表格数据,可能包含了推文内容、用户信息、情绪标签等字段。CSV文件由于其简单通用的格式,非常适合用于存储和交换结构化数据集。 4. 数据集应用场景:此类数据集可用于多种应用场景,包括但不限于: - 政治分析:了解公众对政治辩论的看法和反应。 - 公共情绪研究:分析在特定事件发生时的公众情绪趋势。 - 机器学习和人工智能研究:提供用于训练和测试情绪分析模型的实际数据。 - 媒体监控:监测媒体对某个事件的报道倾向和公众的反应。 - 舆情分析:用于企业或组织了解消费者对其品牌或产品的公众情感。 5. 数据集处理方法:使用该数据集的分析师或研究者可能会用到一些常见的数据处理技术或工具,例如数据清洗、文本预处理(去除无用字符、分词、词干提取等)、特征工程(向量化文本数据,例如使用TF-IDF或Word2Vec等)、模型训练(使用机器学习算法,如朴素贝叶斯、支持向量机、深度学习等进行情绪分类)。 6. 数据集潜在价值:这类社交媒体情绪数据集可用于研究社交媒体对政治决策的影响、公共政策的情感反馈、公共意见的形成过程等。通过分析人们在政治辩论等关键时刻的反应,研究人员和政策制定者可以更好地了解公众的需求和情绪变化,进而对策略进行调整。 7. 数据集潜在问题:在使用此类数据集时,研究人员应该注意可能存在的问题,比如数据偏差(样本选择偏差、时间偏差等)、数据可靠性(推文的真实性和客观性)和隐私保护问题(推文可能包含敏感个人信息)。此外,情绪分析模型的准确性也受到所用语言模型和数据集大小的限制。 综上所述,该“First GOP Debate Twitter Sentiment”数据集是研究社交媒体情绪分析、政治事件公众情绪反应等领域的重要资源,具备丰富的应用价值和研究潜力。然而,在具体分析和应用之前,需要对数据集进行适当的评估和处理,以确保研究结果的有效性和可靠性。

相关推荐

filetype

/** * 录像线程,负责根据录像状态,取音视频GOP并调用storage接口写入文件 */ static void *record_thread_func(void *p) { avdm_cursor_t video_cursor, audio_cursor; avdm_block_t video_block, audio_block; STORAGE_DATA storage_data, audio_storage_data; EVENT_ENTRY gop_event; time_t stopped_time = 0; U8 last_video_codec_type = 0xff; U8 audio_codec_type = 0xff; U8 last_audio_codec_type = 0xff; BOOL first_video_gop = TRUE; BOOL first_audio_gop = TRUE; S32 ret = 0; char record_name[16] = {0}; int event_id = 0; BOOL time_jump = FALSE; PTR_REC_EVENT_PARAM_S ptr_event_params = gs_rec_chn[0].event_param; const struct partition_ops *ops = NULL; int record_stm_fd = 0; #ifdef VIDEO_AVBR_ENABLE BOOL need_set_i_frame = FALSE; avdm_block_t refer_block = {0}; #endif int last_ret = STM_NO_ERR; int is_got_future_audio = 0; //音频帧时间是否大于视频帧时间(相差大于2秒) #ifdef DUAL_CAM avdm_cursor_t video2_cursor; STORAGE_DATA video2_storage_data; avdm_block_t video2_block; S32 ret_v2 = 0; int is_got_future_video2 = 0; int is_carry_video2 = 1; #endif strcpy(record_name, "record"); prctl(PR_SET_NAME, record_name, 0, 0, 0); memset(&video_cursor, 0, sizeof(avdm_cursor_t)); memset(&audio_cursor, 0, sizeof(avdm_cursor_t)); #ifdef DUAL_CAM memset(&video2_cursor, 0, sizeof(avdm_cursor_t)); #endif while(g_record && g_record->thread_state != THREAD_STATE_FINISHED) { #ifdef VIDEO_AVBR_ENABLE need_set_i_frame = FALSE; #endif if (THREAD_STATE_STOPPED == g_record->thread_state) { /* 线程停止,解除avdm关联并等待唤醒信号 */ if (TRUE == video_cursor.attaching) { avdm_detach_block(g_record->type, &video_cursor); } if (TRUE == audio_cursor.attaching) { avdm_detach_block(AVDM_TYPE_AUDIO, &audio_cursor); } #ifdef DUAL_CAM if (TRUE == video2_cursor.attaching) { avdm_detach_block(g_record->video2_type, &video2_cursor); } #endif /* 线程停止,结束侦测事件clip */ if (StgDisk_IsV1()) { SnapshotIndexMod_ClipEnd(); SnapshotIndexMod_PostMsg(eDetMsgType_Idle, 0); ops = get_partition_ops(STORAGE_TYPE_VIDEO); if (ops->update_event_entry_end_status) { STM_INFO("update event entry end status"); record_stm_fd = get_record_curr_stm_fd(); ops->update_event_entry_end_status(get_stm_file(record_stm_fd)); } stm_update_index(); } else { #ifdef HOMEKIT_ONBOARDING_SUPPORT set_record_led_state(REC_STAT_PRE); #endif StgMod_Sync(); } record_stop_events(); if (get_cur_record_type() == REC_TYPE_MOTION) { g_record->rec_status = REC_STAT_PRE; } /* 线程停止再开始时为定时录像状态时,让其拿最新的GOP,避免出现音频或视频GOP被覆盖导致音视频不同步现象 */ if (FALSE == first_video_gop) first_video_gop = TRUE; if (FALSE == first_audio_gop) first_audio_gop = TRUE; is_got_future_audio = 0; #ifdef DUAL_CAM is_got_future_video2 = 0; #endif pthread_mutex_lock(&g_record->thread_mutex); if (g_record->thread_state == THREAD_STATE_STOPPED) { pthread_cond_wait(&g_record->thread_cond, &g_record->thread_mutex); } pthread_mutex_unlock(&g_record->thread_mutex); continue; } if (REC_STAT_PRE == g_record->rec_status) { /* 从录像状态切换回预录状态,更新索引回放才不会缺失录像 */ if (StgDisk_IsV1()) { SnapshotIndexMod_ClipEnd(); ops = get_partition_ops(STORAGE_TYPE_VIDEO); if (ops->update_event_entry_end_status) { STM_INFO("update event entry end status"); record_stm_fd = get_record_curr_stm_fd(); ops->update_event_entry_end_status(get_stm_file(record_stm_fd)); } /* 在录像状态切换到预录状态时,将各事件的写入状态初始化。 */ for (event_id = TP_EVENT_TYPE_MIN; event_id <= TP_EVENT_TYPE_MAX; ++event_id) { ptr_event_params[event_id].write_status = NOT_START; } stm_update_index(); } else { #ifdef HOMEKIT_ONBOARDING_SUPPORT set_record_led_state(REC_STAT_PRE); #endif StgMod_Sync(); } g_record->need_update_index = FALSE; /* 如果从录像状态切换回预录状态,解除与avdm的关联 */ if (TRUE == video_cursor.attaching) { avdm_detach_block(g_record->type, &video_cursor); } if (TRUE == audio_cursor.attaching) { avdm_detach_block(AVDM_TYPE_AUDIO, &audio_cursor); } #ifdef DUAL_CAM if (TRUE == video2_cursor.attaching) { avdm_detach_block(g_record->video2_type, &video2_cursor); } #endif if (FALSE == first_video_gop) first_video_gop = TRUE; if (FALSE == first_audio_gop) first_audio_gop = TRUE; is_got_future_audio = 0; #ifdef DUAL_CAM is_got_future_video2 = 0; #endif /* TODO: 如果当前GOP还没有保存是否需要强制产生I帧; * 当前还没写到最新的GOP,需要通过时间戳进行判断;*/ /* 预录GOP由AVDM保留,等待唤醒 */ pthread_mutex_lock(&g_record->status_mutex); if ((g_record->thread_state == THREAD_STATE_RUNNING) && (REC_STAT_PRE == g_record->rec_status)) { pthread_cond_wait(&g_record->status_cond, &g_record->status_mutex); } pthread_mutex_unlock(&g_record->status_mutex); continue; } if (REC_STAT_RECORD == g_record->rec_status || REC_STAT_DELAY == g_record->rec_status) { if ((status_of_event(0, TP_EVENT_TYPE_MOTION_DETECT) == EVENT_STATUS_START || status_of_event(0, TP_EVENT_TYPE_MOTION_DETECT) == EVENT_STATUS_PROCESS || status_of_event(0, TP_EVENT_TYPE_FACE_GALLERY) == EVENT_STATUS_START || status_of_event(0, TP_EVENT_TYPE_FACE_GALLERY) == EVENT_STATUS_PROCESS) && (first_video_gop == TRUE)) { /* 移动侦测录像,取预录GOP */ ret = avdm_get_pre_block(g_record->type, &video_cursor, &video_block); #ifdef DUAL_CAM ret_v2 = avdm_get_pre_block(g_record->video2_type, &video2_cursor, &video2_block); //DC_TODO 时间同步机制 #endif } else { /* 定时录像第一次取GOP,将cursor置空防止取到上一次停止时录像的下一个GOP */ if (first_video_gop == TRUE) { memset(&video_cursor, 0, sizeof(avdm_cursor_t)); #ifdef DUAL_CAM memset(&video2_cursor, 0, sizeof(avdm_cursor_t)); #endif } /* 定时录像,取最新GOP,或移动侦测/定时录像的下一个GOP */ ret = avdm_get_next_block(g_record->type, &video_cursor, &video_block); #ifdef DUAL_CAM if (ret == ERR_NONE || ret == -ERR_OW_GET_LATEST) { /* 上次video2已经取得比video晚则先不取video2,否则取video2 */ if (!is_got_future_video2) { get_video2_block: ret_v2 = avdm_get_next_block(g_record->video2_type, &video2_cursor, &video2_block); } /* 若取video2有误或video2比video早,重新取video2 */ if ((-ERR_FRAME_NOT_READY == ret_v2) || (-ERR_AVDM_NOT_READY == ret_v2) || video_block.start_time - video2_block.start_time >= 2) { pthread_mutex_lock(&g_record->video2_gop_mutex); if (g_record->thread_state == THREAD_STATE_RUNNING) { pthread_cond_wait(&g_record->video2_gop_cond, &g_record->video2_gop_mutex); } pthread_mutex_unlock(&g_record->video2_gop_mutex); if (g_record->thread_state == THREAD_STATE_RUNNING) { goto get_video2_block; } else { continue; } } /* 若video2比video晚,本次不携带,下次不取 */ else if (video2_block.start_time - video_block.start_time >= 2) { is_carry_video2 = 0; is_got_future_video2 = 1; } /* video2与video时间同步,本次携带,下次需要取 */ else { is_carry_video2 = 1; is_got_future_video2 = 0; } } #endif } /* * 不管是否是取预录GOP,将其置为FALSE,从定时录像切换到正在移 * 动时的移动侦测录像,不需要拿预录GOP,仍然只需要直接拿下一个GOP */ first_video_gop = FALSE; if ((-ERR_FRAME_NOT_READY == ret) || (-ERR_AVDM_NOT_READY == ret)) { pthread_mutex_lock(&g_record->video_gop_mutex); if (g_record->thread_state == THREAD_STATE_RUNNING) { pthread_cond_wait(&g_record->video_gop_cond, &g_record->video_gop_mutex); } pthread_mutex_unlock(&g_record->video_gop_mutex); continue; } else { /* 取到的GOP中包含会显示镜头遮蔽画面的视频帧,丢弃该GOP */ if (video_block.start_time <= g_record->lens_mask_stopped_time + 1) { STM_INFO("drop gop: start_time: %ld, lens mask_time: %ld", video_block.start_time, g_record->lens_mask_stopped_time); is_got_future_audio = 0; #ifdef DUAL_CAM is_got_future_video2 = 0; #endif continue; } #ifdef DUAL_CAM if (video2_block.start_time <= g_record->lens_mask_stopped_time + 1) { STM_INFO("drop video2 gop: start_time: %ld, lens mask_time: %ld", video2_block.start_time, g_record->lens_mask_stopped_time); is_got_future_audio = 0; is_got_future_video2 = 0; continue; } #endif /* * 如果视频get_next取到的是最新的GOP,音频也需要取最新的GOP, * detach并memset cursor保证取到音频最新的GOP * * -ERR_OW_GET_LATEST在去预录GOP接口不会返回,这里不会进入取 * 音频预录GOP的分支 */ if (-ERR_OW_GET_LATEST == ret) { STM_INFO("video gop overlap, current start_time(%d)", video_block.start_time); avdm_detach_block(AVDM_TYPE_AUDIO, &audio_cursor); memset(&audio_cursor, 0, sizeof(avdm_cursor_t)); is_got_future_audio = 0; } #ifdef DUAL_CAM /* DC_TODO video2取到最新帧,以video1为准,暂不做处理*/ if (ret_v2 == -ERR_OW_GET_LATEST) { STM_INFO("Ignore video2 gop overlap, current start_time(%d)", video2_block.start_time); ret_v2 = ERR_NONE; } #endif get_audio_block: if (!is_got_future_audio) { if ((status_of_event(0, TP_EVENT_TYPE_MOTION_DETECT) == EVENT_STATUS_START || status_of_event(0, TP_EVENT_TYPE_MOTION_DETECT) == EVENT_STATUS_PROCESS || status_of_event(0, TP_EVENT_TYPE_FACE_GALLERY) == EVENT_STATUS_START || status_of_event(0, TP_EVENT_TYPE_FACE_GALLERY) == EVENT_STATUS_PROCESS) && (first_audio_gop == TRUE)) { /* 移动侦测录像,取预录GOP */ ret = avdm_get_pre_block(AVDM_TYPE_AUDIO, &audio_cursor, &audio_block); } else { /* 定时录像第一次取GOP,将cursor置空防止取到上一次停止时录像的下一个GOP */ if (first_audio_gop == TRUE) { memset(&audio_cursor, 0, sizeof(avdm_cursor_t)); } ret = avdm_get_next_block(AVDM_TYPE_AUDIO, &audio_cursor, &audio_block); } } first_audio_gop = FALSE; if ((-ERR_FRAME_NOT_READY == ret) || (-ERR_AVDM_NOT_READY == ret)) { pthread_mutex_lock(&g_record->audio_gop_mutex); if (g_record->thread_state == THREAD_STATE_RUNNING) { pthread_cond_wait(&g_record->audio_gop_cond, &g_record->audio_gop_mutex); } pthread_mutex_unlock(&g_record->audio_gop_mutex); if (g_record->thread_state == THREAD_STATE_RUNNING) { goto get_audio_block; } else { continue; } } if (-ERR_OW_GET_LATEST == ret) { STM_INFO("audio gop overlap, current start_time(%d)", video_block.start_time); } } } int is_carry_audio = 1; if (labs(video_block.start_time - audio_block.start_time) >= 2) { /* : 视频时间大于音频时间,则继续取靠后的音频,直到时间同步 */ if (video_block.start_time > audio_block.start_time) { STM_INFO("video(%d) audio(%d) interval(%d)", video_block.start_time, audio_block.start_time, video_block.start_time - audio_block.start_time); while (1) { int err = avdm_get_next_block(AVDM_TYPE_AUDIO, &audio_cursor, &audio_block); // 1.取不到下一个音频帧,跳出 if (err != ERR_NONE && err != (-ERR_OW_GET_LATEST)) { is_carry_audio = 0; is_got_future_audio = 0; break; } // 2.判断取到音频帧是否满足时间同步条件 if (labs(video_block.start_time - audio_block.start_time) < 2) { is_got_future_audio = 0; break; } // 3.取到的音频帧时间超前(大于视频帧2s) if (audio_block.start_time > video_block.start_time) { is_got_future_audio = 1; break; } } } /* : 音频时间大于视频时间,暂停取音频帧,先写入视频,直到音频视频时间同步,再一起写入 */ else { is_carry_audio = 0; is_got_future_audio = 1; } STM_INFO("carry_audio(%d) future_audio(%d) v(%d)-a(%d) %d", is_carry_audio, is_got_future_audio, video_block.start_time, audio_block.start_time, labs(video_block.start_time - audio_block.start_time)); } /* 处理GOP */ init_storage_data(&storage_data, &video_block, 1); #ifdef DUAL_CAM memset(&video2_storage_data, 0, sizeof(video2_storage_data)); if(!ret_v2 && is_carry_video2) { init_storage_data(&video2_storage_data, &video2_block, 0); } #endif /* 写入带音频帧才对其初始化 */ memset(&audio_storage_data, 0, sizeof(audio_storage_data)); if (is_carry_audio) { init_storage_data(&audio_storage_data, &audio_block, 0); } /* 视频GOP赋值编码类型 */ storage_data.video_codec_type = video_block.unique_info.video.encode_type; /* 音频编码类型 */ audio_codec_type = audio_block.unique_info.audio.encode_type; /* 定时录像,如果GOP开始时间比定时录像设定时间早,需丢弃该GOP */ if (get_cur_record_type() == REC_TYPE_TIME && !check_gop_valid_by_plan_time(storage_data.end_time)) { STM_INFO("time record set time %u, gop start/end time: %u ~ %u, abandon", get_cur_record_type_set_time(), storage_data.start_time, storage_data.end_time); continue; } /* 如果拿到的视频GOP结束时间大于起始时间超过5秒或者结束时间小于起始时间,需要丢弃该GOP */ if ((storage_data.end_time - storage_data.start_time > GOP_DURATION_THRESHOLD) || (storage_data.end_time < storage_data.start_time)) { STM_INFO("gop time error, start_time: %u, end_time: %u", storage_data.start_time, storage_data.end_time); continue; } /* 如果上一个GOP结束时间与当前GOP的起始时间相差超过TIME_JUMP_THRESHOLD,需要新起事件处理时间跳变 */ if ((storage_data.start_time - stopped_time > g_record->time_jump_threshold) || (stopped_time - storage_data.start_time > 0)) { STM_INFO("time jump, gop start_time: %u, stopped time: %u", storage_data.start_time, stopped_time); if (stopped_time - storage_data.start_time > 0) { /* 时间向前跳变,强制新起文件 */ STM_DEBUG("force new file"); storage_data.force_new_file = 1; } if ((g_record->force_file_when_time_jumped) && (storage_data.start_time - stopped_time > g_record->time_jump_threshold)) { /* 部分电信平台机型要求时间向后发生跳变时也要强制新起文件, * 但对于磁盘刚格式完,还未写入数据的情况,不强制新起文件 */ if (g_newly_formatted) { STM_INFO("Newly formatted, not force new file evenif time jump."); } else { storage_data.force_new_file = 1; STM_DEBUG("force new file"); } } time_jump = TRUE; } else { time_jump = FALSE; } /* 如果上一个GOP的编码类型与当前GOP编码类型不同(H264/H265),需要新起文件存储 */ if ((last_video_codec_type != 0xff) && (last_video_codec_type != storage_data.video_codec_type)) { storage_data.force_new_file = 1; STM_INFO("video codec changed from %d to %d", last_video_codec_type, storage_data.video_codec_type); STM_DEBUG("force new file"); } if ((last_audio_codec_type != 0xff) && (last_audio_codec_type != audio_codec_type)) { storage_data.force_new_file = 1; STM_INFO("audio codec changed from %d to %d", last_audio_codec_type, audio_codec_type); STM_DEBUG("force new file"); } /* 支持多事件 start */ for (event_id = TP_EVENT_TYPE_MIN; event_id <= TP_EVENT_TYPE_MAX; event_id++) { if ((time_jump || (last_video_codec_type != storage_data.video_codec_type) || (last_audio_codec_type != audio_codec_type)/* || item->need_new_event*/) && (ptr_event_params[event_id].write_status == START_NOT_END)) { if (storage_data.event_status[event_id] == EVENT_STATUS_END) { if (event_id != TP_EVENT_TYPE_GENERAL) { storage_data.event_status[event_id] = EVENT_STATUS_ONE_BUFF; } } else if (storage_data.event_status[event_id] != EVENT_STATUS_EMPTY) { storage_data.event_status[event_id] = EVENT_STATUS_START; } ptr_event_params[event_id].write_status = NOT_START; } switch (storage_data.event_status[event_id]) { case EVENT_STATUS_START: case EVENT_STATUS_RECORD_DELAY: if (ptr_event_params[event_id].write_status == START_NOT_END) { storage_data.event_status[event_id] = EVENT_STATUS_PROCESS; } else { storage_data.event_status[event_id] = EVENT_STATUS_START; #ifdef VIDEO_AVBR_ENABLE if (video_block.unique_info.video.iframe_type == TP_FRAME_TYPE_VIRTUAL_I) { need_set_i_frame = TRUE; } #endif } break; case EVENT_STATUS_END: if (ptr_event_params[event_id].write_status == START_NOT_END) { storage_data.event_status[event_id] = EVENT_STATUS_END; } else { storage_data.event_status[event_id] = EVENT_STATUS_EMPTY; } break; case EVENT_STATUS_ONE_BUFF: #ifdef VIDEO_AVBR_ENABLE if (video_block.unique_info.video.iframe_type == TP_FRAME_TYPE_VIRTUAL_I) { need_set_i_frame = TRUE; } #endif break; default: storage_data.event_status[event_id] = EVENT_STATUS_EMPTY; break; } } /* 支持多事件 end */ stopped_time = storage_data.end_time; /* Save end time of gop */ last_video_codec_type = storage_data.video_codec_type; /* Save video codec type of gop */ last_audio_codec_type = audio_codec_type; #ifdef VIDEO_AVBR_ENABLE /* 事件发生但是该gop没有真实i帧,需要在该gop前加入前一个真实i帧 */ if (need_set_i_frame) { STM_INFO("need set i frame"); if (OK != avdm_get_refer_block(g_record->type, video_cursor.desc, &refer_block)) { STM_ERROR("get refer block fail"); continue; } else { storage_data.i_frame_buf = refer_block.addr; } } #endif if (stm_check_event_duration(&storage_data)) { storage_data.force_new_file = 1; } #ifdef DUAL_CAM if (stm_check_mp4_file_size(&storage_data, &video2_storage_data, &audio_storage_data)) #else if (stm_check_mp4_file_size(&storage_data, &audio_storage_data)) #endif { storage_data.force_new_file = 1; } #ifdef VIDEO_AVBR_ENABLE /* 需要切换文件时该gop没有真实i帧,需要在该gop前加入前一个真实i帧 */ if (storage_data.force_new_file && video_block.unique_info.video.iframe_type == TP_FRAME_TYPE_VIRTUAL_I && !storage_data.i_frame_buf) { STM_INFO("Force new file, need set i frame."); if (OK != avdm_get_refer_block(g_record->type, video_cursor.desc, &refer_block)) { STM_ERROR("get refer block fail"); continue; } else { storage_data.i_frame_buf = refer_block.addr; } } #endif #define STM_WRITE_MAX_COST_TIME_INTERVAL 600 //sd卡写入GOP速度过慢(写入时间超过定义值,单位:ms),则打印相关信息,方便分析问题 uint64_t t_start, t_end; t_start = monotonic_ms(); if (StgDisk_IsV1()) { /* 写入SD卡 */ memset(&gop_event, 0, sizeof(EVENT_ENTRY)); ret = stm_write(g_record->stm_fd, &storage_data, &audio_storage_data, &gop_event); t_end = monotonic_ms(); if (t_end - t_start > STM_WRITE_MAX_COST_TIME_INTERVAL) { STM_INFO("stm_write time_cost(%dms) ret(%d) new(%d) v_gop(%dKB) a_gop(%dKB) ", (int)(t_end - t_start), ret, storage_data.force_new_file, storage_data.buf_len/1024, audio_storage_data.buf_len/1024); } /* 写入结果失败,则打印相关信息 */ if (last_ret != ret) { STM_ERROR("stm_write ret: %d -> %d", last_ret, ret); last_ret = ret; if (ret == STM_ERR_DISK_FULL || ret == STM_ERR_DISK_UNAVAIL) { VodStatus_UpdateFullStatus(1); } else { VodStatus_UpdateFullStatus(0); } } if (ret == STM_NO_ERR) { //写入sd卡成功,更新clip时间 SnapshotIndexMod_ClipUpdateTime(storage_data.start_time, storage_data.end_time, storage_data.is_det_end); if (is_event_push_sync(SnapshotIndexMod_LastSyncTime())) { g_record->need_update_index = TRUE; } } else { //写入sd卡错误,则结束侦测事件clip SnapshotIndexMod_ClipEnd(); } if (ret == STM_NO_ERR) { /* 写入数据成功后,将标志位复位 */ if (g_newly_formatted) { STM_INFO("stm_write success, reset flag g_newly_formatted!"); g_newly_formatted = 0; } for (event_id = TP_EVENT_TYPE_MIN; event_id <= TP_EVENT_TYPE_MAX; event_id++) { switch (storage_data.event_status[event_id]) { case EVENT_STATUS_END: case EVENT_STATUS_EMPTY: ptr_event_params[event_id].write_status = NOT_START; break; case EVENT_STATUS_PROCESS: STM_DEBUG("event_id[%d] EVENT_STATUS_PROCESS", event_id); break; case EVENT_STATUS_START: STM_DEBUG("event_id[%d] EVENT_STATUS_START", event_id); ptr_event_params[event_id].write_status = START_NOT_END; break; default: break; } } } if (TRUE == g_record->need_update_index) { stm_update_index(); g_record->need_update_index = FALSE; } } else { #ifdef DUAL_CAM ret = StgMod_Write((void *)&storage_data, (void *)&video2_storage_data, (void *)&audio_storage_data); #else ret = StgMod_Write((void *)&storage_data, (void *)&audio_storage_data); #endif /* 写入结果失败,则打印相关信息 */ if (last_ret != ret) { STM_ERROR("StgMod_Write ret: %d -> %d", last_ret, ret); last_ret = ret; if (ret == STM_ERR_DISK_FULL) { VodStatus_UpdateFullStatus(1); } else { VodStatus_UpdateFullStatus(0); } } t_end = monotonic_ms(); if (t_end - t_start > STM_WRITE_MAX_COST_TIME_INTERVAL) { STM_INFO("StgMod_Write time_cost(%dms) ret(%d) new(%d) v_gop(%dKB) a_gop(%dKB) ", (int)(t_end - t_start), ret, storage_data.force_new_file, storage_data.buf_len/1024, audio_storage_data.buf_len/1024); } //消息推送同步事件索引 #define CLIP_MIN_DURATION 5 if (EventCtx_ClipDuration() > CLIP_MIN_DURATION) { if (is_event_push_sync((time_t)EventCtx_LastSyncTime())) { g_record->need_update_index = TRUE; } } /* 索引同步 */ if (TRUE == g_record->need_update_index) { StgMod_UpdateIndex(); g_record->need_update_index = FALSE; } } } StgMod_DeInit(); STM_DEBUG("record thread exit"); return (void *)OK; } 想把第二路视频里改一下,不用avdm相关的接口,用另一个模块的数据,但是那个模块还没完成,所以先兼容一个空的视频,怎么做?

filetype

for Itr=1:Max_Itr for i=1:nop % Determin RSs and Search by LTs %-------------------------------------------------------- Rf=((i-1)/(nop-1))(RM-Rm)+Rm; Rd=norm(GOP-GTs(:,RKs(i))); Rs=Rf(Rf>=Rd)+Rd*(Rd>Rf); LTs_C=Create_LTs(No_LTs,Rs,Dim); LTs=repmat(GTs(:,RKs(i)),1,No_LTs)+LTs_C; LTs=SS(LTs,Par_Interval); %---------------- if Graphic_on==1 subplot(2,2,1) hold off pause(0.000001); plot(LTs(1,:),LTs(2,:),'x'); hold on ezplot(['(x-' num2str(GTs(1,RKs(i))) ')^2 + (y-' num2str(GTs(2,RKs(i))) ')^2 -' num2str(Rs^2)],[0 10],[0 10]); hold off xlim([Par_Interval(1,1) Par_Interval(1,2)]); ylim([Par_Interval(2,1) Par_Interval(2,2)]); pbaspect([1 1 1]) title('Local Search') xlabel('x_1') ylabel('x_2') end %---------------- LTs_Cost=Ev_Fcn(LTs,Fcn_Name); [L_min,L_inx]= min(LTs_Cost); if L_min<=LP_Cost(RKs(i)) LP(:,RKs(i))=LTs(:,L_inx); LP_Cost(RKs(i))=L_min; end if L_min<=GOP_Cost GOP_Cost=L_min; GOP=LTs(:,L_inx); end end % Search by GTs %-------------------------------------------------------- for i=1:nop GTs(:,i)=New_GT(GTs(:,i),LP(:,i),GOP,Lambda,Theta,Beta); GTs(:,i)=SS(GTs(:,i),Par_Interval); GTs_Cost(i)=Ev_Fcn(GTs(:,i),Fcn_Name); end % Ranking %-------------------------------------------------------- [Gts_Sorted,RKs]=sort(GTs_Cost); GOP_B=GTs(:,RKs(1)); GOP_Cost_B=Gts_Sorted(1); if GOP_Cost_B<=GOP_Cost GOP_Cost=GOP_Cost_B; GOP=GOP_B; end OP_Cost(Itr+1)=GOP_Cost; %---------------- if Graphic_on==1 subplot(2,2,2) hold off pause(.000001) plot(GTs(1,:),GTs(2,:),'*') hold on plot(GOP(1,:),GOP(2,:),'X','color','red') xlim([Par_Interval(1,1) Par_Interval(1,2)]); ylim([Par_Interval(2,1) Par_Interval(2,2)]); hold off pbaspect([1 1 1]*3) title('Global Search') xlabel('x_1') ylabel('x_2') end %---------------- %---------------- if Graphic_on==1 subplot(2,2,3) hold off pause(.000001) plot(OP_Cost(1:Itr+1)) pbaspect([2 1 1]) xlim([1 Max_Itr+1]) title(['Cost=' num2str(GOP_Cost,'%4.10f')]) xlabel('Iteration') ylabel('Cost') else hold off pause(.000001) plot(0:Itr,OP_Cost(1:Itr+1),'.','MarkerSize',15,'LineStyle','-','Color',[214 30 0]/255,'MarkerEdgeColor',[3 93 118]/255) pbaspect([2 1 1]) title(['Itr=' num2str(Itr) ', Cost=' num2str(GOP_Cost,'%4.10f')]) xlim([0 Max_Itr]) xlabel('Iteration') ylabel('Cost') end %---------------- end 把这段MATLAB代码转换为python代码

weixin_38542148
  • 粉丝: 4
上传资源 快速赚钱