12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #ifndef RTC_TOOLS_CONVERTER_CONVERTER_H_
- #define RTC_TOOLS_CONVERTER_CONVERTER_H_
- #include <stdio.h>
- #include <string>
- namespace webrtc {
- namespace test {
- class Converter {
- public:
- Converter(int width, int height);
-
-
- bool ConvertRGBAToI420Video(std::string frames_dir,
- std::string output_file_name,
- bool delete_frames);
- private:
- int width_;
- int height_;
-
- int YPlaneSize() const { return width_ * height_; }
-
- int UPlaneSize() const { return ((width_ + 1) / 2) * ((height_) / 2); }
-
- int VPlaneSize() const { return ((width_ + 1) / 2) * ((height_) / 2); }
-
- int SrcStrideFrame() const { return width_ * 4; }
-
- int DstStrideY() const { return width_; }
-
- int DstStrideU() const { return (width_ + 1) / 2; }
-
- int DstStrideV() const { return (width_ + 1) / 2; }
-
- int InputFrameSize() const { return width_ * height_ * 4; }
-
-
- bool AddYUVToFile(uint8_t* y_plane,
- int y_plane_size,
- uint8_t* u_plane,
- int u_plane_size,
- uint8_t* v_plane,
- int v_plane_size,
- FILE* output_file);
-
- bool AddYUVPlaneToFile(uint8_t* yuv_plane, int yuv_plane_size, FILE* file);
-
-
- bool ReadRGBAFrame(const char* input_file_name,
- int input_frame_size,
- unsigned char* buffer);
-
-
- std::string FindFullFileName(std::string dir_name, std::string file_name);
-
- bool FileExists(std::string file_name_to_check);
-
-
- std::string FormFrameName(int width, int number);
- };
- }
- }
- #endif
|