awk parses the filename - it uses the underscore character to separate fields. A few shells can also do this, like bash. Field $4 is the one you want, so awk prints the the $4 field. $[field number] is the awk syntax for each field in a file - the default field separator is tab/space. The -F '_' tells awk to use underscore.
The sed command looks at a line and filters out only the part that has this pattern "(number)x(number)" punctuated by underscores. So in this pattern
.*_\([0-9][0-9]*x[0-9][0-9]*\)_.*
the regex "." is the entire line to the left of the first 300 as is the "." to the right of the second 300. The [0-9][0-9]* filters out only numbers and the "x" and "_" are taken literally...