History

Add interface for external arf indexes.

Pass in external arf indexes to encode command.

Cheng Chen committed 6 years ago

Commit 7e665ec1 parent 04848493 files · +22 −0Browse files

Unified · Split

3 files
  1. vp9/encoder/vp9_encoder.h +4 −0
  2. vp9/simple_encode.cc +10 −0
  3. vp9/simple_encode.h +8 −0
vp9/encoder/vp9_encoder.h+4−0
@@ -521,6 +521,10 @@ typedef struct KMEANS_DATA { · 520 unmodified lines
521521 typedef struct ENCODE_COMMAND {
522522 int use_external_quantize_index;
523523 int external_quantize_index;
524+ int use_external_arf;
525+ // A list of binary flags set from the external controller.
526+ // Each binary flag indicates whether the frame is an arf or not.
527+ const int *external_arf_indexes;
524528 } ENCODE_COMMAND;
525529
526530 typedef struct PARTITION_INFO {
vp9/simple_encode.cc+10−0
@@ -573,6 +573,9 @@ static void SetGroupOfPicture(int first_is_key_frame, int use_alt_ref, · 572 unmodified lines
573573 }
574574 }
575575
576+// Gets group of picture information from VP9's decision, and update
577+// |group_of_picture| accordingly.
578+// This is called at the starting of encoding of each group of picture.
576579 static void UpdateGroupOfPicture(const VP9_COMP *cpi, int start_coding_index,
577580 GroupOfPicture *group_of_picture) {
578581 int first_is_key_frame;
@@ -601,6 +604,7 @@ SimpleEncode::SimpleEncode(int frame_width, int frame_height, · 22 unmodified lines
601604 num_frames_ = num_frames;
602605 frame_coding_index_ = 0;
603606 // TODO(angirbid): Should we keep a file pointer here or keep the file_path?
607+ assert(infile_path != nullptr);
604608 in_file_ = fopen(infile_path, "r");
605609 if (outfile_path != nullptr) {
606610 out_file_ = fopen(outfile_path, "w");
@@ -687,6 +691,12 @@ std::vector<std::vector<double>> SimpleEncode::ObserveFirstPassStats() { · 80 unmodified lines
687691 return output_stats;
688692 }
689693
694+void SimpleEncode::SetExternalGroupOfPicture(const bool use_external_arf,
695+ const int *external_arf_indexes) {
696+ impl_ptr_->cpi->encode_command.use_external_arf = use_external_arf;
697+ impl_ptr_->cpi->encode_command.external_arf_indexes = external_arf_indexes;
698+}
699+
690700 void SimpleEncode::StartEncode() {
691701 assert(impl_ptr_->first_pass_stats.size() > 0);
692702 vpx_rational_t frame_rate =
vp9/simple_encode.h+8−0
@@ -272,6 +272,14 @@ class SimpleEncode { · 271 unmodified lines
272272 // values. For details, please check FIRSTPASS_STATS in vp9_firstpass.h
273273 std::vector<std::vector<double>> ObserveFirstPassStats();
274274
275+ // Sets arf indexes for the video from external input.
276+ // The arf index determines whether a frame is arf or not.
277+ // Therefore it also determines the group of picture size.
278+ // If set, VP9 will use the external arf index to make decision.
279+ // This function is called only once before StartEncde().
280+ void SetExternalGroupOfPicture(bool use_external_arf,
281+ const int *external_arf_indexes);
282+
275283 // Initializes the encoder for actual encoding.
276284 // This function should be called after ComputeFirstPassStats().
277285 void StartEncode();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t